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

CSS IDs in MD are displayed as normal text. #2948

Open
CapinWinky opened this issue Mar 26, 2019 · 2 comments
Open

CSS IDs in MD are displayed as normal text. #2948

CapinWinky opened this issue Mar 26, 2019 · 2 comments
Labels
bug 🐛 Issue concerns a bug. level 1 ❕ A bug that caused minor damage: App is still usable, but minor features might not work.

Comments

@CapinWinky
Copy link

Current behavior

If giving a MD element an ID via {#SomeID} syntax, it is displayed as normal text.

# My Heading {#MyHeadingID}
erroneously becomes
<h1>My Heading {#MyHeadingID}</h1>

Expected behavior

The renderer should apply the ID in the element's HTML tag so it can be linked to or manipulated with CSS.

# My Heading {#MyHeadingID}
Should become
<h1 id="MyHeadingID">My Heading</h1>

Steps to reproduce

  1. Give an element an ID like {#ThisID}
  2. See how it is treated as normal text.
  3. Wonder why This doesn't link to that element's location
  4. Wonder why CSS for #ThisID has no effect on the element

Environment

  • Version : Installer version 0.11.15
  • OS Version and name : Windows 10 Pro x64 1809
@CapinWinky
Copy link
Author

I should note that only IDs for headings are in the official extended markdown syntax spec, but in practice it has also been applied to the parent element when found in a list, table, etc. So, if any line of markdown that is specifying a table ends in the {#SomeID} syntax, that ID would be applied to the <table> tag. In cases where multiple IDs are found, you could just use the first or last one, whatever is easiest for your parsing strategy.

@MiloTodt
Copy link
Contributor

MiloTodt commented Mar 28, 2019

While not the exact solution you're looking for, doing this may fit your usecase for now.

image

@ZeroX-DG ZeroX-DG added the bug 🐛 Issue concerns a bug. label Mar 31, 2019
@Flexo013 Flexo013 added the level 1 ❕ A bug that caused minor damage: App is still usable, but minor features might not work. label Jun 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Issue concerns a bug. level 1 ❕ A bug that caused minor damage: App is still usable, but minor features might not work.
Projects
None yet
Development

No branches or pull requests

4 participants