Skip to content

Commit

Permalink
fix: handle CRLF in snippet plugin
Browse files Browse the repository at this point in the history
closes #3499
  • Loading branch information
brc-dd committed Jan 25, 2024
1 parent 3b860f9 commit 5811b62
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/node/markdown/plugins/snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ export const snippetPlugin = (md: MarkdownIt, srcDir: string) => {
return fence(...args)
}

let content = fs.readFileSync(src, 'utf8')
let content = fs.readFileSync(src, 'utf8').replace(/\r\n/g, '\n')

if (regionName) {
const lines = content.split(/\r?\n/)
const lines = content.split('\n')
const region = findRegion(lines, regionName)

if (region) {
Expand Down

0 comments on commit 5811b62

Please sign in to comment.