Lowdefy

DangerousMarkdown

Render markdown content which can include HTML elements. If the markdown content does not need to render HTML, use the Markdown or MarkdownWithCode blocks instead. Specify what HTML element to allow or remove by changing the default modifying the DOMPurify's options.

The DangerousMarkdown block sanitizes the markdown content using DOMPurify's before converting the markdown to HTML. DangerousMarkdown provides the ability to customize the sanitization options. This comes with some security considerations, please consider DOMPurify's Security Goals and Threat Model for more details regarding the security impact of using the DangerousMarkdown block.

In short, it is strongly advised to never render any user input DangerousMarkdown content, only render hardcoded or trusted markdown and HTML content.

Some Html content:

A simple white title box

id: block_id
type: DangerousMarkdown
properties:
  content: >
    ## Some Html content:


    <div style="background: #123456; padding: 10px;"><h4 style="color: white;">A
    simple white title box</h4></div>

properties:
Customize DOMPurify options. Options are only applied when the block is mounted, thus any parsed settings is only applied at first render.
Content in markdown format.
Style to apply to Markdown div.
DangerousMarkdown headings

Markdown with an iframe:

id: iframes_example
type: DangerousMarkdown
properties:
  DOMPurifyOptions&quot;:
    ADD_TAGS&quot;:
      - iframe
  content: &gt;
    # Markdown with an iframe:

    &lt;iframe style=&quot;max-width: 512px;&quot; width=&quot;100%&quot;
    src=&quot;https://www.youtube.com/embed/7N7GWdlQJlU&quot; frameborder=&quot;0&quot;
    allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope;
    picture-in-picture&quot; allowfullscreen&gt;&lt;/iframe&gt;

type: object
properties:
  properties:
    additionalProperties: false
    properties:
      DOMPurifyOptions:
        description: >-
          Customize DOMPurify options. Options are only applied when the block is
          mounted, thus any parsed settings is only applied at first render.
        type: object
      content:
        description: Content in markdown format.
        type: string
      style:
        description: Style to apply to Markdown div.
        type: object
    type: object