Skip to content

Commit

Permalink
Merge pull request #190 from bingocaller/issue/177-yaml-formatter
Browse files Browse the repository at this point in the history
feat(#177): enable understanding of front matter
  • Loading branch information
jannis-baum authored Nov 12, 2024
2 parents 2ecdad6 + ff364d9 commit 23c3e71
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"markdown-it-deflist": "^3.0.0",
"markdown-it-emoji": "^3.0.0",
"markdown-it-footnote": "^4.0.0",
"markdown-it-front-matter": "^0.2.4",
"markdown-it-github-alerts": "^0.3.0",
"markdown-it-inject-linenumbers": "^0.3.0",
"markdown-it-mark": "^4.0.0",
Expand Down
4 changes: 4 additions & 0 deletions src/parser/markdown.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import MarkdownIt from 'markdown-it';
import anchor from 'markdown-it-anchor';
import frontMatter from 'markdown-it-front-matter';
import highlight from './highlight.js';
import graphviz from './dot.js';
import mermaid from './mermaid.js';
Expand Down Expand Up @@ -59,6 +60,9 @@ mdit.use(toc, config.tocOptions);

// MARK: untyped plugins done

// markdown-it-front-matter requires a callback function but we aren’t doing
// anything with it, so we just pass in a noop.
mdit.use(frontMatter, () => {});
// anchor has to be added after attribute plugin for ids to work
mdit.use(anchor, {
permalink: anchor.permalink.ariaHidden({
Expand Down
4 changes: 4 additions & 0 deletions tests/rendering/markdown-additional.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
front-matter: This should not be shown in the renderer
---

# Additional Markdown test file

Test various other Markdown syntax here, starting with the table of contents
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2190,6 +2190,11 @@ markdown-it-footnote@^4.0.0:
resolved "https://registry.yarnpkg.com/markdown-it-footnote/-/markdown-it-footnote-4.0.0.tgz#02ede0cb68a42d7e7774c3abdc72d77aaa24c531"
integrity sha512-WYJ7urf+khJYl3DqofQpYfEYkZKbmXmwxQV8c8mO/hGIhgZ1wOe7R4HLFNwqx7TjILbnC98fuyeSsin19JdFcQ==

markdown-it-front-matter@^0.2.4:
version "0.2.4"
resolved "https://registry.yarnpkg.com/markdown-it-front-matter/-/markdown-it-front-matter-0.2.4.tgz#cf29bc8222149b53575699357b1ece697bf39507"
integrity sha512-25GUs0yjS2hLl8zAemVndeEzThB1p42yxuDEKbd4JlL3jiz+jsm6e56Ya8B0VREOkNxLYB4TTwaoPJ3ElMmW+w==

markdown-it-github-alerts@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/markdown-it-github-alerts/-/markdown-it-github-alerts-0.3.0.tgz#acab7db57f4e204c8d1c987403c367738d7026b0"
Expand Down

0 comments on commit 23c3e71

Please sign in to comment.