I noticed this while reading one of my Obsidian notes with Leaf. The note used --- as section separators, and one section was rendered differently from the others.
I reproduced this with Leaf 1.25.0. A reduced example looks like this:
# TLS notes
A short introduction.
---
### SSL
SSL is the older protocol and is now deprecated.
- SSL 2.0 had known security issues.
- SSL 3.0 was also deprecated after later attacks.
---
### TLS
TLS replaced SSL and is what modern HTTPS uses.
I expected both --- lines to be rendered as thematic breaks, with the content between them still parsed as normal Markdown. In particular, ### SSL should be rendered as a heading and the SSL items should be rendered as a list.
Instead, the section after the first --- can be rendered incorrectly until the next ---. In my case, the heading/list in that section appeared mostly unparsed.
This seems to happen with --- when the next line is non-blank. These variants work as expected:
From a quick look at the source code (with some help from Codex), Leaf already extracts top-of-file frontmatter itself, but then parses the remaining Markdown body with pulldown-cmark using Options::all(). That enables YAML-style metadata blocks, so a body-level --- followed by non-blank content and later another --- can be interpreted as a metadata block instead of a thematic break.
Since frontmatter is already handled separately by Leaf, would it make sense to disable pulldown-cmark metadata block parsing for the remaining body?
let mut options = Options::all();
options.remove(Options::ENABLE_YAML_STYLE_METADATA_BLOCKS);
options.remove(Options::ENABLE_PLUSES_DELIMITED_METADATA_BLOCKS);
I might be missing a case where Leaf intentionally supports metadata blocks inside the document body, but this would make --- thematic breaks behave consistently with *** and ___.
I noticed this while reading one of my Obsidian notes with Leaf. The note used
---as section separators, and one section was rendered differently from the others.I reproduced this with Leaf 1.25.0. A reduced example looks like this:
I expected both
---lines to be rendered as thematic breaks, with the content between them still parsed as normal Markdown. In particular,### SSLshould be rendered as a heading and the SSL items should be rendered as a list.Instead, the section after the first
---can be rendered incorrectly until the next---. In my case, the heading/list in that section appeared mostly unparsed.This seems to happen with
---when the next line is non-blank. These variants work as expected:From a quick look at the source code (with some help from Codex), Leaf already extracts top-of-file frontmatter itself, but then parses the remaining Markdown body with
pulldown-cmarkusingOptions::all(). That enables YAML-style metadata blocks, so a body-level---followed by non-blank content and later another---can be interpreted as a metadata block instead of a thematic break.Since frontmatter is already handled separately by Leaf, would it make sense to disable pulldown-cmark metadata block parsing for the remaining body?
I might be missing a case where Leaf intentionally supports metadata blocks inside the document body, but this would make
---thematic breaks behave consistently with***and___.