-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Allow setting section id from markdown #385
Comments
Setting a specific id for better styling stability seems like a reasonable proposal. However, due to the risk of negatively impacting web applications that render user-provided Marp(it) Markdown, the For example, if an app embeds Marp slides like this: <div id="app">
<!-- Marp slides here -->
</div>
<!-- Markup for app-specific features here --> According to HTML specifications, a document cannot contain same ids. If an id named Style stability already can be achieved with the ---
class: |
section.stable-styling {
background: #fc6;
}
---
<!-- _class: stable-styling -->
# Stable styling ---
style: |
section:has(#stable-styling) {
background color: #fc4;
}
---
# Stable styling |
The _class directive fixes the stable styling issue! Being able to set ids would still improve reloading a slide deck, as inserting slides before the current slide wouldn't cause problems.
This could be solved by prefixing the ids. |
If the ability to change the ID prefixing could make confuse the Markdown author, as it might result in IDs that do not match what the author has set. If the prefix was implicitly added to the author-specified ID
That is specific to the incremental update of VS Code Markdown preview, especially to morphdom. Marpit/Marp renderer itself has no involvement in the incremental update of DOM, so I feel it seems not to be appropriate as an issue for the Marpit framework. If the incremental update algorithm of VS Code had an attribute that served a role similar to React's |
Currently, section ids are numeric (
<section id="1">...</section>
)It would be nice if the id could be set in markdown, maybe even derived from the first heading in it.
This would make styling certain pages easier and also improve reload stability when slide are added before the currently viewed slide.
Btw. very nice VS Code extension! I love this project!
The text was updated successfully, but these errors were encountered: