From b49b6e67d3dd2cd71824330762816b3659c0cb40 Mon Sep 17 00:00:00 2001 From: developomp Date: Sun, 19 Dec 2021 20:49:39 +0900 Subject: [PATCH] added footnote feature --- source/generate/parseMarkdown.ts | 3 +++ source/markdown/posts/test post.md | 7 +++++++ source/package.json | 1 + source/types/markdown-it-footnote.d.ts | 1 + source/yarn.lock | 5 +++++ 5 files changed, 17 insertions(+) create mode 100644 source/types/markdown-it-footnote.d.ts diff --git a/source/generate/parseMarkdown.ts b/source/generate/parseMarkdown.ts index 4078f67..766d043 100644 --- a/source/generate/parseMarkdown.ts +++ b/source/generate/parseMarkdown.ts @@ -5,6 +5,8 @@ import markdownItTaskCheckbox from "markdown-it-task-checkbox" // a TODO list ch import markDownItMark from "markdown-it-mark" // text highlighting import markdownItSub from "markdown-it-sub" // markdown subscript import markdownItSup from "markdown-it-sup" // markdown superscript +import markdownItFootnote from "markdown-it-footnote" // markdown footnote + import highlightLines from "markdown-it-highlight-lines" // highlighting specific lines in code blocks import toc from "markdown-toc" // table of contents generation @@ -42,6 +44,7 @@ const md = markdownIt({ .use(markdownItSub) .use(markdownItSup) .use(highlightLines) + .use(markdownItFootnote) export default function parseMarkdown(markdownRaw: string): string { return ( diff --git a/source/markdown/posts/test post.md b/source/markdown/posts/test post.md index 450b1fa..9f46369 100644 --- a/source/markdown/posts/test post.md +++ b/source/markdown/posts/test post.md @@ -50,6 +50,10 @@ A post have title, post date, tags, and content. 1. [ ] Ordered list task sub-item (unchecked) 2. [x] Ordered list task sub-item (checked) +## Footnote + +css only causes pain[^css_bad] and python is overrated[^python_is_overrated]. + ## Code Here's a `code`. @@ -115,3 +119,6 @@ $e=mc^2$ is actually $e^2=(mc^2)^2 + (pc)^2$. $$ \ce{6 CO2 + 6 H2O <=>[{photosynthesis}][{respiration}] C6H12O6 + 6 O2} $$ + +[^css_bad]: Based on my experience building this website, Dec 2021. +[^python_is_overrated]: Based on my infinite wisdom, Dec 2021. diff --git a/source/package.json b/source/package.json index 0ff867e..6896003 100644 --- a/source/package.json +++ b/source/package.json @@ -31,6 +31,7 @@ "markdown-it": "^12.3.0", "markdown-it-anchor": "^8.4.1", "markdown-it-attrs": "^4.1.0", + "markdown-it-footnote": "^3.0.3", "markdown-it-highlight-lines": "^1.0.2", "markdown-it-mark": "^3.0.1", "markdown-it-sub": "^1.0.0", diff --git a/source/types/markdown-it-footnote.d.ts b/source/types/markdown-it-footnote.d.ts new file mode 100644 index 0000000..7046cc6 --- /dev/null +++ b/source/types/markdown-it-footnote.d.ts @@ -0,0 +1 @@ +declare module "markdown-it-footnote" diff --git a/source/yarn.lock b/source/yarn.lock index d830723..9046912 100644 --- a/source/yarn.lock +++ b/source/yarn.lock @@ -8011,6 +8011,11 @@ markdown-it-attrs@^4.1.0: resolved "https://registry.yarnpkg.com/markdown-it-attrs/-/markdown-it-attrs-4.1.0.tgz#e27f023cd8731b15b4a5e971d51e6f45b3b947bc" integrity sha512-xd1SuNQPArGYl3SN1bsOHRnmMenkqeLDbTR0udeyGMSFBnaOtxP4yz1SEKrjsV/XYFygFAeKFHgbbj6AwxbTfA== +markdown-it-footnote@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/markdown-it-footnote/-/markdown-it-footnote-3.0.3.tgz#e0e4c0d67390a4c5f0c75f73be605c7c190ca4d8" + integrity sha512-YZMSuCGVZAjzKMn+xqIco9d1cLGxbELHZ9do/TSYVzraooV8ypsppKNmUJ0fVH5ljkCInQAtFpm8Rb3eXSrt5w== + markdown-it-highlight-lines@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/markdown-it-highlight-lines/-/markdown-it-highlight-lines-1.0.2.tgz#33ecf51cd9d9e741cd86f583cb95b67de81fc9c7"