-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider sanitizing HTML tags from TOC entries #24
Comments
Been having the same problem for a while now, so thanks for opening this issue. If you do not use the clickable links option in aTOC, you can quite easily skip over the whole headache of sanitizing the headers for HTML. But it still causes a headache for other reasons and having clickable headers is part of the reason why I even use the plugin to begin with. Hoping to have a somewhat fixed fork ready this week. |
Finally finished the first revision of this. When it comes to stripping HTML tags, I've made it completely optional. Small overview of the new options: allowStyleHTML: {
type: 'boolean',
default: false,
comment: 'When includeLinks is false, allows HTML styling for headings',
},
includeMarkdownLinks: {
type: 'boolean',
default: true,
comment: 'When includeLinks is false, allows Markdown links in headings',
}, I'm not quite sure what the "standard behaviour" should be when (Also the first revision is seriously buggy and full of unnecessary code. PR comes when I get enough time to clean it up a smidge.) Edit: (24.12.23) added one more option: showMarkdownLinksInLinks: {
type: 'boolean',
default: false,
comment: 'Allows Markdown links in headings when links are also enabled.',
}, Also still cleaning up the code. |
Hello! HTML is now stripped in Unfortunately I couldn't find a way to keep the formatting without impacting other features |
Some plugins, eg. Highlightr plugin inject markup via HTML tags which messes up the TOC:
It would be nice if the plugin could strip any HTML tags, a simple regex
<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>
replace to''
might do it.Example payload:
<mark style="background: #FFF3A3A6;">Some title</mark>
Preserving the markup as opposed to escaping it would also be nice, but is more a nice to have.
The text was updated successfully, but these errors were encountered: