Skip to content

Extras

MarkdownViewer

Bit.BlazorUI.ExtrasMdViewerMD

BitMarkdownViewer parses Markdown into an AST and renders it straight to the Blazor render tree - no JavaScript interop, no third-party packages. Composable pipelines add exactly the flavors a document needs, untrusted input is sanitized and bounded by default, and the parsed tree, the rendering of any node and the words the renderers write are all yours to change.

Customization

Defaults for every viewer of a subtree through BitParams, styling the document with classes and CSS variables, and right-to-left layouts.

Cascading parameters

BitParams with a BitMarkdownViewerParams sets defaults (pipeline, input limits, templates, styles) for every viewer under it - one place for a site's flavors and its highlighter. A viewer's own value wins: the second one keeps the Basic pipeline.

Release 9.4

  • Old parser replaced
  • Docs
FlavorCascaded
GitHub✔

Release 9.4

  • [x] ~~Old~~ parser replaced
  • [ ] Docs

| Flavor | Cascaded | |--------|:--------:| | GitHub | ✔ |

Style & Class

Style and Class reach the root, and ordinary CSS reaches the elements inside. The public --bit-MarkdownViewer-* CSS variables restyle the document - on one viewer, an ancestor, or the whole app from :root.

A styled viewer, set apart with an inline Style.


A classy viewer

Every code span and heading inside it is restyled from the page's own stylesheet.



CSS variables:

Restyled with variables

A serif body, purple headings and tinted code.

A quote with a purple bar.

ColumnValue
one1
two2

RTL

Dir="BitDir.Rtl" renders a right-to-left document; the stylesheet uses logical properties, so quote bars, list indents and table alignment flip with it. BitDir.Auto gives each paragraph, heading and list the direction of its own text - for content mixing both, such as user comments.

نمایشگر مارک‌داون

متن درشت و مورب در کنار کد درون‌خطی.

Note

نوار رنگی این کادر با جهت متن جابه‌جا می‌شود.

  • مورد اول
  • مورد دوم
    • مورد تودرتو
ستونمقدار
یک۱
دو۲

A comment thread

Each paragraph takes the direction of its own text.

این پاراگراف فارسی است و از راست به چپ چیده می‌شود.

  • English item

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.