Skip to content

Commit

Permalink
chore: update ?
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidWells committed Apr 8, 2024
1 parent f00f4eb commit c0fc101
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/transforms/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ module.exports = function CODE(api) {

const selectedLines = lines.slice(startLine + 1, endLine)

const trimBy = selectedLines[0]?.match(/^(\s*)/)?.[1]?.length
const firstMatch = selectedLines[0] && selectedLines[0].match(/^(\s*)/);
const trimBy = firstMatch && firstMatch[1] ? firstMatch[1].length : 0;
const newValue = `${selectedLines.map(line => line.substring(trimBy).replace(/^\/\/ CODE_SECTION:INCLUDE /g, "")).join("\n")}`
// console.log('newValue', newValue)
code = newValue
Expand Down

0 comments on commit c0fc101

Please sign in to comment.