gettalong / kramdown

kramdown is a fast, pure Ruby Markdown superset converter, using a strict syntax definition and supporting several common extensions.
http://kramdown.gettalong.org
Other
1.72k stars 274 forks source link

Kramdown option in Jekyll fail #742

Closed dungxibo123 closed 2 years ago

dungxibo123 commented 2 years ago

Consider a simple markdown case

# 4. Loi ket
Lorem lorem lorem

My rendered output is

<h1 id="4-loi-ket">4. Loi ket</h1>
<p>Lorem lorem lorem</p>

But I want it turned into

<section id="4-loi-ket">
<h1>.....
....
....
</section>

Following the document here image I set my _config.yml file into

markdown: kramdown
kramdown:
  auto-id-stripping: true
  highlighter: rouge
  input: GFM

So I thought my desire content will be wrapped by the section tag, but the rendered html did not change. Am I misunderstanding the document content or I need set other option to achieve desire output.

Thanks

gettalong commented 2 years ago

In the description of auto_ids it says that this is for generating ID values for HTML header tags, i.e. <h1> up to <h6>. This has nothing to do with modifying the structural output like you thought it would, i.e. it doesn't add any <section> tag nor any other tag; it just generates the header ID.

Apart from this option meaning something different than you thought, there is also the problem with determining your "desired content": This cannot be done by kramdown since it can't know when your section ends.