diff options
author | ache <ache@ache.one> | 2023-06-20 18:35:49 +0200 |
---|---|---|
committer | ache <ache@ache.one> | 2023-06-20 18:35:49 +0200 |
commit | d7693a0dfccf88ff3a54cca39ec39837a441ee22 (patch) | |
tree | dac51db218363851e5089407e818bc14c2ac72ce /src | |
parent | Style for iframe (diff) |
Fix table of contents
Diffstat (limited to 'src')
-rw-r--r-- | src/build/i18n.mjs | 10 | ||||
-rw-r--r-- | src/build/to-html.mjs | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/build/i18n.mjs b/src/build/i18n.mjs index 0978d70..7ecb2e1 100644 --- a/src/build/i18n.mjs +++ b/src/build/i18n.mjs @@ -17,7 +17,8 @@ const i18n = { 'retour-sur-laoc-2021-semaine-1.md', '2FA-discord-sur-pc.md', 'duckduckgo-google-en-mieux.md', - ] + ], + toc_keyword: "Sommaire" }, en: { intro: { @@ -33,7 +34,8 @@ const i18n = { }, articles: [ 'c-language-quirks.md', - ] + ], + toc_keyword: "Table of contents" } } @@ -52,5 +54,9 @@ export function addDescription(alt_lang) { return alt_lang; } +export function getTocHeading() { + return Object.entries(i18n).map(([_, v]) => v.toc_keyword).join('|'); +} + export default i18n; diff --git a/src/build/to-html.mjs b/src/build/to-html.mjs index adfcd7a..786f91d 100644 --- a/src/build/to-html.mjs +++ b/src/build/to-html.mjs @@ -15,6 +15,7 @@ import rehypeStringify from 'rehype-stringify'; import rehypeHighlight from 'rehype-highlight'; import remarkSpecialBox from './special_box.mjs'; import remarkRemoveFootnoteHeader from './remove-footnote-header.mjs'; +import {getTocHeading} from './i18n.mjs'; const autoLinkOption = { behavior: 'wrap', @@ -31,7 +32,7 @@ const pictureOptions = { const generator = unified() .use(remarkParse) .use(remarkGfm) - .use(remarkToc, {heading: 'Sommaire', tight: true, ordered: true}) + .use(remarkToc, {heading: getTocHeading(), tight: true, ordered: true}) .use(remarkMath) .use(remarkDirective) .use(remarkSpecialBox) @@ -49,7 +50,7 @@ const generator = unified() const generatorMd = unified() .use(remarkParse) .use(remarkGfm) - .use(remarkToc, {heading: 'Sommaire', tight: true, ordered: true}) + .use(remarkToc, {heading: getTocHeading(), tight: true, ordered: true}) .use(remarkMath) .use(remarkDirective) .use(remarkSpecialBox) |