Skip to content

Commit a2f73b6

Browse files
fix: pass options to parse instead of using global setOptions, which can affect tests
1 parent 650d274 commit a2f73b6

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

packages/docs-builder/src/gen-html.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('convertMarkdownToHtml', () => {
130130
'<p>This is -CO<sub>2</sub>-</p>\n'
131131
)
132132
expect(convertMarkdownToHtml(undefined, '# This is CO2')).toBe(
133-
'<h1 id="this-is-co2">This is CO<sub>2</sub></h1>\n'
133+
'<h1>This is CO<sub>2</sub></h1>\n'
134134
)
135135
expect(convertMarkdownToHtml(undefined, '> This is _CO2_')).toBe(
136136
'<blockquote>\n<p>This is <em>CO<sub>2</sub></em></p>\n</blockquote>\n'

packages/docs-builder/src/gen-html.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,9 @@ export function convertMarkdownToHtml(context: Context, md: string): string {
595595
})
596596

597597
// Parse the Markdown into HTML
598-
return marked.parse(md)
598+
return marked.parse(md, {
599+
headerIds: false
600+
})
599601
}
600602

601603
/**

packages/docs-builder/src/parse.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ export function parseMarkdownPageContent(
6060
relPath: string,
6161
origMarkdownWithFrontmatter: string
6262
): MarkdownPage {
63-
// Configure marked.js
64-
marked.setOptions({
65-
headerIds: false
66-
})
67-
6863
// Separate frontmatter from the content
6964
const origMarkdownSeparated = matter(origMarkdownWithFrontmatter)
7065
const origMarkdown = origMarkdownSeparated.content

0 commit comments

Comments
 (0)