Skip to content

josh-heyer/remark-admonitions

 
 

Repository files navigation

This is a fork, because I needed slightly different functionality. If you're reading this, you should consider that maybe this isn't fully "baked" and have a look at the original project.

How this differs from Elvis Wolcott's original

My primary goal is reasonable compatibility with content written against Python-Markdown's Admonitions plugin: https://squidfunk.github.io/mkdocs-material/reference/admonitions/

That means:

  • Allows indented, rather than fenced, admonitions (both are supported, and can both be used in the same document if desired). Indented admonitions can be nested (but whyyyy)
  • An optional space between the tag and the keyword
  • Case-insensitive keyword matching
  • Quoted titles (if title begins with ' or ", then only content between that and matching quote will be used; mostly useful for empty titles right now)
  • Empty titles ("" results in no title at all, vs. a default title)
  • Simpler AST allows programmatic creation without worrying about the details of the HTML representation (those details will be added in the transformation step).
  • Compiler allows transformation and round-tripping with remark-stringify: load Markdown containing admonitions, modify the AST as desired, write it back to Markdown. Preserves original case of keyword, fenced vs. indented layout.

One other feature that turns out to be useful: the prettierFriendly option forces a blank line between the heading and body of annotations. For indented annotations specifically, that makes it much more likely that Prettier (or other Markdown processing tools) will spit out something that is likely to be still parsed as an indented annotation (vs. potentially eating the rest of the document as an unclosed fenced annotation)

See the original README for history & usage details

About

Add admonitions support to Remarkable

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • HTML 59.5%
  • JavaScript 34.7%
  • CSS 5.8%