marked-gfm-heading-id
Advanced tools
Comparing version 4.0.1 to 4.1.0
@@ -124,8 +124,7 @@ (function (global, factory) { | ||
const raw = unescape(this.parser.parseInline(tokens, this.parser.textRenderer)) | ||
.toLowerCase() | ||
.trim() | ||
.replace(/<[!\/a-z].*?>/gi, ''); | ||
const level = depth; | ||
const id = `${prefix}${slugger.slug(raw)}`; | ||
const heading = { level, text, id }; | ||
const id = `${prefix}${slugger.slug(raw.toLowerCase())}`; | ||
const heading = { level, text, id, raw }; | ||
headings.push(heading); | ||
@@ -132,0 +131,0 @@ |
{ | ||
"name": "marked-gfm-heading-id", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "marked GFM heading ids", | ||
@@ -55,14 +55,14 @@ "main": "./lib/index.cjs", | ||
"@semantic-release/git": "^10.0.1", | ||
"@semantic-release/github": "^10.1.3", | ||
"@semantic-release/github": "^10.1.6", | ||
"@semantic-release/npm": "^12.0.1", | ||
"@semantic-release/release-notes-generator": "^14.0.1", | ||
"babel-jest": "^29.7.0", | ||
"eslint": "^9.8.0", | ||
"eslint": "^9.9.0", | ||
"globals": "^15.9.0", | ||
"jest-cli": "^29.7.0", | ||
"marked": "^14.0.0", | ||
"rollup": "^4.20.0", | ||
"semantic-release": "^24.0.0", | ||
"rollup": "^4.21.0", | ||
"semantic-release": "^24.1.0", | ||
"tsd": "^0.31.1" | ||
} | ||
} |
@@ -32,2 +32,3 @@ # marked-gfm-heading-id | ||
- `level`: The heading level (1-7) | ||
- `raw`: The raw text (stripped of HTML rendering if any; this is usefull for situation like `marked("# [heading](./link)");`) | ||
- `id`: The id given to the heading including any prefix | ||
@@ -46,3 +47,3 @@ | ||
<ul id="table-of-contents"> | ||
${headings.map(({id, text, level}) => `<li><a href="#${id}" class="h${level}">${text}</a></li>`)} | ||
${headings.map(({id, raw, level}) => `<li><a href="#${id}" class="h${level}">${raw}</a></li>`)} | ||
</ul> | ||
@@ -49,0 +50,0 @@ ${html}`; |
@@ -25,2 +25,3 @@ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars | ||
text: string; | ||
raw: string; | ||
id: string; | ||
@@ -27,0 +28,0 @@ } |
@@ -39,8 +39,7 @@ import GithubSlugger from 'github-slugger'; | ||
const raw = unescape(this.parser.parseInline(tokens, this.parser.textRenderer)) | ||
.toLowerCase() | ||
.trim() | ||
.replace(/<[!\/a-z].*?>/gi, ''); | ||
const level = depth; | ||
const id = `${prefix}${slugger.slug(raw)}`; | ||
const heading = { level, text, id }; | ||
const id = `${prefix}${slugger.slug(raw.toLowerCase())}`; | ||
const heading = { level, text, id, raw }; | ||
headings.push(heading); | ||
@@ -47,0 +46,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32204
71
408