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

Use Thematic Breaks (or Horizontal Rules) as Explicit Section Breaks #8

Open
Crissov opened this issue Feb 4, 2018 · 4 comments
Open

Comments

@Crissov
Copy link

Crissov commented Feb 4, 2018

There is currently no way to get this HTML from any Markdown with this plugin:

<section>
  <h1>Upper-Level Heading</h1>
  <p>upper-level section</p>
  <section>
    <h2>Lower-Level Heading</h2>
    <p>lower-level section</p>
  </section>
  <p>upper-level section again!</p>    <!-- this is impossible right now -->
</section>

It would be possible, though, if you treated thematic breaks (---, *** or ___) as explicit section breaks.

Upper-Level Heading
===================

upper-level section

Lower-Level Heading
-------------------

lower-level section

---

upper-level section again!

The three different available types could even be used for slightly different meanings:

  • *** end the current section
  • --- end all sections but the top level, except when the current context is the top level and in that case also start a new section
  • ___ plain old <hr />

Related discussion from CommonMark Discourse

@arve0
Copy link
Owner

arve0 commented Feb 7, 2018

Hi!
Thanks for your contribution, thoroughly description and pointers of earlier discussions. First of, I think this sounds like a good idea. Implementing it should be relatively easy too.

A couple of questions:

  1. Should this be the default behavior, or is it better to enable it through an option?
  2. Regarding differentiating between the three types of thematic breaks, what is the convention/has other projects landed on the same meaning?

@Crissov
Copy link
Author

Crissov commented Feb 7, 2018

  1. 🤷 Your plugin, you decide. For slide presentations, it seems like an established convention, though.
  2. I don’t think any other implementation has picked up on any differentiation. For * * *, I was thinking of its use in books, while --- resembles second-level headings in Markdown.

@Crissov
Copy link
Author

Crissov commented Feb 7, 2018

PS: Other conventions would be possible and reasonable, too, of course, e.g.:

  • ___ end current section </section>
  • *** split section </section><section>
  • --- start anonymous section <section>

@arve0
Copy link
Owner

arve0 commented Feb 7, 2018

PS: Other conventions would be possible and reasonable, too, of course, e.g.:

Yes. I guess one might need sections without headers, especially for slides. I like the *** idea, it gives a neat slide format.

RyeNCode added a commit to RyeNCode/markdown-it-header-sections that referenced this issue Feb 27, 2024
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