Skip to content
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

Add a setting for the header anchor symbol to remove (default is #) #48

Open
Lamecarlate opened this issue Nov 6, 2024 · 1 comment

Comments

@Lamecarlate
Copy link

Is your feature request related to a problem? Please describe.

I use markdownItAnchor to add id and link on my headings. By default, the link is on a # symbol. It can be changed in the settings, for example with §. But if it's not a # it's displayed in the table of contents.

I suppose that it's because of this line in SimplifyResults.js:

const text = $(el).text().replace(' #', '')

Describe the solution you'd like

I would like a setting in the toc plugin, in order to let it know what is the element to remove.

Additional context

With #

default: with # the table of content contains only the text of headings

With §

with paragraph symbol: the table of content contains the text of headings with § at the end

@uncenter
Copy link

FYI my fork https://github.com/uncenter/eleventy-plugin-toc has an option for this, ignoredElements - it is an array of selectors to remove from inside the headers. I'm not sure exactly what your HTML is here but I would guess you can set it to ['a'] to remove <a>/link elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants