Skip to content

Commit

Permalink
Revert markdown update
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres committed Dec 21, 2023
1 parent b9ccf80 commit fd4506b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@types/marked": "^5.0.2",
"@types/marked": "^4.3.2",
"@types/pluralize": "0.0.33",
"boxen": "^7.1.1",
"chokidar": "^3.5.3",
Expand Down Expand Up @@ -89,7 +89,7 @@
"dependencies": {
"colors": "1.4.0",
"finalhandler": "^1.2.0",
"marked": "^11.1.0",
"marked": "^4.3.0",
"puppeteer": "^21.6.1",
"sade": "^1.8.1",
"serve-static": "^1.15.0"
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/core/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ class Renderer extends marked.Renderer {
return { language, ...metaData };
}

heading(text, level, raw) {
heading(text, level, raw, slugger) {
const headingWithIdRegex = /(.+)\s+{#([\w-]+)}$/;
if (headingWithIdRegex.test(text)) {
const [, textContent, id] = text.match(headingWithIdRegex);
return `<h${level} id="${id}">${textContent}</h${level}>`;
}
return super.heading(text, level, raw);
return super.heading(text, level, raw, slugger);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/spec/core/data-include-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ describe("Core — Data Include", () => {
expect(p.textContent).toBe("A paragraph.");

const pre = doc.querySelector("#includes > pre");
expect(pre.querySelector("code").classList).toContain("language-html");
expect(pre.querySelector("code").classList).toContain("html");
expect(pre.textContent).toContain("<!DOCTYPE html>");

expect(doc.querySelector("#includes .note")).toBeFalsy();
Expand Down
4 changes: 2 additions & 2 deletions tests/spec/core/markdown-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ describe("Core - Markdown", () => {

expect(jsBlock.firstElementChild.localName).toBe("code");
expect(
jsBlock.querySelector("code.hljs").classList.contains("language-js")
jsBlock.querySelector("code.hljs").classList.contains("js")
).toBeTruthy();
expect(jsBlock.querySelector("code.hljs")).not.toBeNull();
expect(jsBlock.querySelector("code.hljs span")).not.toBeNull();
expect(jsBlock.querySelector(".respec-button-copy-paste")).toBeNull();

expect(normalBlock.firstElementChild.localName).toBe("code");
Expand Down

0 comments on commit fd4506b

Please sign in to comment.