javalent / admonitions

Adds admonition block-styled content to Obsidian.md
MIT License
1.07k stars 70 forks source link

Pandoc Div Syntax #230

Closed zcysxy closed 2 years ago

zcysxy commented 2 years ago

Hi @valentine195, since your other plugin Markdown Attributes is inspired by Pandoc syntax, I'm sure you are aware of the divs syntax as well. Have you considered adding it as an admonition syntax?

zcysxy commented 2 years ago

The reasons I propose Pandoc div syntax are the drawbacks of other syntaxes:

  1. Code fence: almost all apps will wrap a Markdown code block with<pre> or <code> tag, making it hard to render the content inside as Markdown.
  2. Callout: you have to add a > before every line, which can be painful for long content when a shortcut is not available.
valentine195 commented 2 years ago

I actually used to have a similar syntax in the plugin. I removed it in favor of the MS document syntax (that has now also been removed due to the native callouts).

Unfortunately it is quite difficult to implement something like this because of the way Obsidian handles the way individual blocks of markdown are rendered and rerendered. My implementation was buggy and hard to maintain because I had to intercept every markdown block and determine if it should be in one of these fenced admonitions.