mirror of
https://gitgud.io/BondageProjects/Bondage-College.git
synced 2026-04-28 04:19:50 +00:00
Merge branch 'changelog' into 'master'
BUG: Fix missing heading IDs in the changelog See merge request BondageProjects/Bondage-College!6215
This commit is contained in:
commit
c22ecce424
1 changed files with 8 additions and 1 deletions
|
|
@ -130,7 +130,14 @@ async function generateChangelogHtml() {
|
|||
|
||||
const startIndex = sourceMarkdown.search(/^## \[R[0-9a-zA-Z]+]/m);
|
||||
const trimmedMarkdown = sourceMarkdown.substring(startIndex);
|
||||
const renderedMarkdown = await marked.parse(trimmedMarkdown);
|
||||
|
||||
// Restore the heading ID assignment that got removed at _some_ point in Marked
|
||||
const renderer = new marked.Renderer();
|
||||
renderer.heading = function ({ text, depth }) {
|
||||
const id = text.toLowerCase().replace(/[^a-zA-Z0-9]+/g, "");
|
||||
return `<h${depth} id="${id}">${text}</h${depth}>`;
|
||||
}
|
||||
const renderedMarkdown = await marked.parse(trimmedMarkdown, { renderer });
|
||||
|
||||
const $ = cheerio.load(sourceHtml);
|
||||
$("body").empty()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue