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

Render header ID and/or preamble ID in preview #159

Open
gmccullo opened this issue Mar 2, 2024 · 0 comments
Open

Render header ID and/or preamble ID in preview #159

gmccullo opened this issue Mar 2, 2024 · 0 comments

Comments

@gmccullo
Copy link

gmccullo commented Mar 2, 2024

If a header has an ID, it would be nice to have that ID applied to a section tag in the rendered HTML in the preview. For example:

markdown

#### foobar{#special}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

current preview

<div class="markdown-body">
  <h2 id="foobar">foobar</h2>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</div>

desired preview

<div class="markdown-body">
  <section id="special">
    <h2 id="foobar">foobar</h2>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
  </section>
</div>

Rationale: This is basically what Pandoc does when it converts markdown to html or epub. And that lets us use ID selectors in CSS to apply styles to a particular section of the document:

#special {
  font-size: large;
}

Since the "special" id is not in the preview HTML that CSS selector doesn't work in preview. You can only see it after compiling the epub.

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