Noizu.Slack.Mrkdwn (Noizu.Slack v0.1.0)

Copy Markdown View Source

GitHub-flavoured Markdown → Slack mrkdwn. Deterministic, line-based, no deps.

Markdownmrkdwn
# Heading (any level)*Heading*
**bold** / __bold__*bold*
*em*_em_
~~strike~~~strike~
[text](url) / ![alt](url) / <url><url|text> / <url|alt> / <url>
- item / * item / + item• item (nested: 4 spaces per level)
- [ ] todo / - [x] done• ☐ todo / • ☑ done
1. item1. item
> quote> quote
---a rule line
fenced code``` fences kept (language tag dropped), body verbatim
inline codekept
tablesmonospace (fenced) block with padded columns
HTML tagsstripped (<br> → newline)

&, <, > in text are escaped as Slack requires (escape: false disables). Runs of blank lines collapse to one.

Summary

Functions

Converts GitHub-flavoured markdown to Slack mrkdwn. Options: :escape (default true).

Converts markdown and splits it into section blocks, each within the section text limit (:max_chars, default 3000). Splits prefer paragraph boundaries, then line boundaries; code fences are re-opened/closed across splits. Returns a plain list — run it through Noizu.Slack.Blocks.validate/1 to enforce the 50-block cap.

Functions

from_markdown(md, opts \\ [])

@spec from_markdown(String.t(), keyword()) :: String.t()

Converts GitHub-flavoured markdown to Slack mrkdwn. Options: :escape (default true).

to_blocks(md, opts \\ [])

@spec to_blocks(String.t(), keyword()) :: [Noizu.Slack.Blocks.block()]

Converts markdown and splits it into section blocks, each within the section text limit (:max_chars, default 3000). Splits prefer paragraph boundaries, then line boundaries; code fences are re-opened/closed across splits. Returns a plain list — run it through Noizu.Slack.Blocks.validate/1 to enforce the 50-block cap.