Skip to content

Commit 5811b62

Browse files
committed
fix: handle CRLF in snippet plugin
closes #3499
1 parent 3b860f9 commit 5811b62

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/node/markdown/plugins/snippet.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ export const snippetPlugin = (md: MarkdownIt, srcDir: string) => {
170170
return fence(...args)
171171
}
172172

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

175175
if (regionName) {
176-
const lines = content.split(/\r?\n/)
176+
const lines = content.split('\n')
177177
const region = findRegion(lines, regionName)
178178

179179
if (region) {

0 commit comments

Comments
 (0)