diff --git a/bin/strip-frontmatter b/bin/strip-frontmatter old mode 100644 new mode 100755 diff --git a/bin/strip-frontmatter.js b/bin/strip-frontmatter.js old mode 100644 new mode 100755 diff --git a/readme.md b/readme.md index a124be7..0dc07e1 100644 --- a/readme.md +++ b/readme.md @@ -107,8 +107,8 @@ const options: MarkdownOptions = { ```bash ./bin/markdown2html \ - --katex-macro '\foobar' '\text{foo}' '\text{bar}' \ - --katex-macro '\bazqux' '\text{baz}' '\text{qux}' + --katex-macro '\foobar' '\text{foo} + \text{bar}' \ + --katex-macro '\bazqux' '\text{baz} + \text{qux}' ``` diff --git a/src/frontmatter.ts b/src/frontmatter.ts index 1e49651..7ef5d48 100644 --- a/src/frontmatter.ts +++ b/src/frontmatter.ts @@ -1,7 +1,7 @@ import * as yaml from 'yaml'; -export function process_frontmatter(document: string) { +export function process_frontmatter(document: string, parse = true) { if (! document.startsWith('---\n')) { return { frontmatter: null, @@ -12,7 +12,7 @@ export function process_frontmatter(document: string) { const endIndex = document.slice(3).indexOf('\n---\n') + 3; const frontmatterYaml = document.slice(3, endIndex); const markdown = document.slice(endIndex + 4); - const frontmatter = yaml.parse(frontmatterYaml); + const frontmatter = parse ? frontmatterYaml : yaml.parse(frontmatterYaml); return { frontmatter, markdown }; }