MdexMultilineCells (MDEx Multiline Cells v0.1.0)

View Source

An MDEx plugin that allows multi-line cells in Markdown tables.

Options

  • :render_as - How multi-line content within table cells should be rendered in the HTML/AST output.
    • :line_break (default) - Renders line breaks inside table cells as <br /> (MDEx.LineBreak) preserving inline formatting.
    • :paragraph - Wraps each multi-line cell line segment in <p> paragraph blocks.
    • :html_br - Renders line breaks as raw <br /> HTML inline nodes (automatically sets render: [unsafe: true]).
  • :guess_multiline - Boolean indicating whether to infer multiline cell continuations based on empty key columns (e.g. 1st column empty). Defaults to true.
  • :key_column - Integer index of the primary key column used for multiline row guessing (0-indexed). Defaults to 0 (1st column).
  • :continuation_syntax - Which Markdown continuation syntax to recognize in raw tables.
    • :all (default) - Recognizes trailing backslashes (\), empty key column continuations, unclosed table cell lines, and explicit <br> tags.
    • :backslash - Recognizes only trailing backslash (\) line continuation.
    • :unclosed - Recognizes unclosed multi-line source table rows.
  • :strip_indentation - Boolean indicating whether to strip leading whitespace on continuation lines. Defaults to true.

Usage

With MDEx.new/1

MDEx.new(markdown: "| Col 1 |\n| --- |\n| Line 1 \\ \nLine 2 |", plugins: [MdexMultilineCells])
|> MDEx.to_html!()

With MDEx.to_html!/2

MDEx.to_html!(markdown, plugins: [MdexMultilineCells])

With Plugin Options

MDEx.to_html!(markdown, plugins: [{MdexMultilineCells, render_as: :paragraph, guess_multiline: true}])

Direct Attachment

doc
|> MdexMultilineCells.attach(render_as: :line_break)
|> MDEx.to_html!()

Summary

Functions

Attaches the multiline cells plugin to an MDEx.Document.

Convenience function to parse markdown into a document with the multiline cells plugin attached.

Convenience function to parse and convert markdown to HTML with the multiline cells plugin attached.

Functions

attach(document, options \\ [])

Attaches the multiline cells plugin to an MDEx.Document.

parse!(markdown, options \\ [])

Convenience function to parse markdown into a document with the multiline cells plugin attached.

to_html!(markdown, options \\ [])

Convenience function to parse and convert markdown to HTML with the multiline cells plugin attached.