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

Make anchors better when using TOC #202

Open
ghost opened this issue Mar 21, 2021 · 7 comments
Open

Make anchors better when using TOC #202

ghost opened this issue Mar 21, 2021 · 7 comments

Comments

@ghost
Copy link

ghost commented Mar 21, 2021

Hi,

Multimarkdown is a wonderful piece of software and it works as advertised. I wanted to file this idea for an improvement of handling table of contents (TOC) anchors when exporting to HTML.

Currently, all TOC anchors are quite plain and there is no processing at this time in multimarkdown. While i can understand that action, it leaves the anchors a bit plain. Example of an anchor, from one HTML page:

foo.bar/index.html#Firstparagraph

Now prom the usability aspect, we should have something more like

foo.bar/index.html#first-paragraph

Now from semantic point of view, it would be neat to have an option to process these anchors a bit. Pandoc does it quite good and can be used as an example:

  • all letters are lowercase
  • all anchors wave dash (-) instead of space
  • you can set TOC title, which will be omitted from the TOC list

Is it possible to think about this and implement it in the future? Thank you.

@fletcher
Copy link
Owner

Perhaps you are not using MultiMarkdown? MultiMarkdown doesn't generate anchors like #Firstparagraph. It lower cases them and strips out characters that are not allowed (such as spaces)

@ghost
Copy link
Author

ghost commented Mar 21, 2021

Perhaps you are not using MultiMarkdown? MultiMarkdown doesn't generate anchors like #Firstparagraph. It lower cases them and strips out characters that are not allowed (such as spaces)

I am using multimarkdown however i am also using cyrillic script for pages therefore case is not being changed.

Other part is true: Latin alphabet headers are converted into lowercase with spaces stripped and no - instead of that space. I can use random ID generator for headers but that is not ideal for cross-linking on pages.

@fletcher
Copy link
Owner

Yes -- unicode case folding would require including a larger library, which is not worth the "cost" for most users.

You can specify a custom label for any header that you like if you don't want to use the default - # Header [whatever-you-want]

@ghost
Copy link
Author

ghost commented Mar 21, 2021

Thank you for the answer. I dont mind the fact that case is capitalized in anchor links but i wanted to mention it.

You can specify a custom label for any header that you like if you don't want to use the default - # Header [whatever-you-want]

I am i aware of that option however I wanted to use fully automated TOC generation without using any hard coded stuff. Is there a way to re-think decision to strip all spaces and instead replace them with dashes? That could be more than welcome feature and it would make anchor links much more readable in general

@fletcher
Copy link
Owner

It would break backwards compatibility with 17 years of MultiMarkdown.... So probably not something I'll do right now, but can consider it the next time there is a major new version.

@ghost
Copy link
Author

ghost commented Mar 28, 2021

Is it possible to rethink maybe as a opt-in switch? Sorry for being pushy, i am just exploring options here.

@fletcher
Copy link
Owner

Possibly.

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

1 participant