I often have to deal with "hostile markdown" — markdown not typed in a SilverBullet environment by somebody (or something).
Therefore I created a library (plug) to fix such things: GitHub - silverbulletmd/silverbullet-markdown-prettify: SilverBullet library that cleans up markdown in an opinionated (and SilverBullet optimized) way · GitHub
Currently this is what it does:
- Convert setext (=== / ---) headings to ATX (#)
- Unwrap soft-wrapped paragraphs (the editor handles wrapping)
- Normalize bullet markers; renumber ordered lists sequentially
- Normalize emphasis markers (with a mid-word * safety override)
- Trim whitespace inside wikilinks ([[ Foo | Bar ]] → [[Foo|Bar]])
- Align pipe tables to uniform column widths
- Collapse runs of spaces (remove hard wrap)
- Lift page-level hashtags into the frontmatter (if there's a frontmatter block)
- Trim trailing whitespace, collapse 3+ blank lines, ensure one trailing newline