Logo

Markdown

Markdown renders formatted text using markdown syntax. Use Text for simple, styled text content, and Markdown when you need rich formatting.
Key features:
  • Rich formatting: Support for headings, bold, italic, lists, links, images, blockquotes, and code blocks
  • Dynamic content: Use @{} binding expressions to inject variables and function results
  • File loading: Load markdown content from external files using the data property

Acquiring content

You can specify Markdown content in these ways.

The content property

Render Markdown content that you calculate or get from other components.

The data property

Render Markdown content from an URL.

Nested text

Render Markdown content that you place directly in a Markdown component.

Whitespace and special characters

Whitespace is significant in Markdown, for example headers using the # syntax must begin in column 1.
These special XML characters are significant too.
< (less than) - Must be escaped as &lt;
> (greater than) - Must be escaped as &gt;
& (ampersand) - Must be escaped as &amp;
" (double quote) - Must be escaped as &quot; in attributes
' (single quote/apostrophe) - Must be escaped as &apos; in attributes
You can use a CDATA section to avoid having to escape these characters individually.
<Markdown>
  <![CDATA[
  ]]>
</Markdown>
Or, as we have done in this page, you can use a code fence (a block delimited by triple backtics) to preserve them.

Supported elements

The Markdown component supports these basic elements.
  • Heading
  • Bold
  • Italic
  • Strikethrough
  • Blockquote
  • Ordered List
  • Unordered List
  • Code
  • Horizontal Rule
  • Link
  • Image
  • Table

Binding Expressions

Our Markdown component is capable of evaluating binding expressions just as other XMLUI components. Use the @{} syntax to wrap expressions that need to be evaluated.
Objects, functions and arrays will be stringified if you place them in Markdown.
Function calls are executed and their return values inlined as strings into markdown.
Example: binding expressions syntax

Properties

content

This property sets the markdown content to display. Alternatively, you can nest the markdown content as a child in a CDATA section. In neither this property value nor any child is defined, empty content is displayed.
Use this property when the text you provide is not static but a result of calculations (you assemble the text or get it from other components).

removeIndents (default: true)

This boolean property specifies whether leading indents should be removed from the markdown content. If set to true, the shortest indent found at the start of the content lines is removed from the beginning of every line.
<App layout="horizontal-sticky" padding="1rem">
  <Markdown removeIndents="true">
    <![CDATA[
      # My Adventure in Markdown Land

      ## The Beginning

      In the bustling city of Markdownville, I embarked on a journey to
      discover the secrets of Markdown. My adventure started in the heart
      of the city, where the first rule of Markdown was inscribed in stone.
    ]]>
  </Markdown>
</App>
Example: removeIndents property
<App layout="horizontal-sticky" padding="1rem">
  <Markdown removeIndents="true">
    <![CDATA[
      # My Adventure in Markdown Land

      ## The Beginning

      In the bustling city of Markdownville, I embarked on a journey to
      discover the secrets of Markdown. My adventure started in the heart
      of the city, where the first rule of Markdown was inscribed in stone.
    ]]>
  </Markdown>
</App>

showHeadingAnchors

This boolean property specifies whether heading anchors should be displayed. If set to true, heading anchors will be displayed on hover next to headings.
If this property is not set, the engine checks if showHeadingAnchors flag is turned on in the global configuration (in the appGlobals configuration object) and displays the heading anchor accordingly.

Events

This component does not have any events.

Exposed Methods

This component does not expose any methods.

Styling

The component itself cannot be styled, but the components that render the final text have customizable style variables.

Theme Variables

VariableDefault Value (Light)Default Value (Dark)
backgroundColor-Admonition$color-primary-100$color-primary-200
backgroundColor-Admonition-danger$color-danger-100$color-danger-100
backgroundColor-Admonition-infononenone
backgroundColor-Admonition-notenonenone
backgroundColor-Admonition-tipnonenone
backgroundColor-Admonition-warning$color-warn-100$color-warn-100
backgroundColor-Blockquote$color-surface-100$color-surface-50
backgroundColor-Markdownnonenone
backgroundColor-Textnonenone
border-Admonition1px solid $color-primary-3001px solid $color-primary-300
border-Blockquotenonenone
borderBottom-Admonitionnonenone
borderBottom-Blockquotenonenone
borderBottomColor-Admonitionnonenone
borderBottomColor-Blockquotenonenone
borderBottomStyle-Admonitionnonenone
borderBottomStyle-Blockquotenonenone
borderBottomWidth-Admonitionnonenone
borderBottomWidth-Blockquotenonenone
borderColor-Admonitionnonenone
borderColor-Admonition-danger$color-danger-300$color-danger-300
borderColor-Admonition-infononenone
borderColor-Admonition-notenonenone
borderColor-Admonition-tipnonenone
borderColor-Admonition-warning$color-warn-300$color-warn-300
borderColor-Blockquotenonenone
borderColor-HorizontalRulenonenone
borderEndEndRadius-Admonitionnonenone
borderEndEndRadius-Blockquotenonenone
borderEndStartRadius-Admonitionnonenone
borderEndStartRadius-Blockquotenonenone
borderHorizontal-Admonitionnonenone
borderHorizontal-Blockquotenonenone
borderHorizontalColor-Admonitionnonenone
borderHorizontalColor-Blockquotenonenone
borderHorizontalStyle-Admonitionnonenone
borderHorizontalStyle-Blockquotenonenone
borderHorizontalWidth-Admonitionnonenone
borderHorizontalWidth-Blockquotenonenone
borderLeft-Admonitionnonenone
borderLeft-Blockquotenonenone
color-Admonitionnonenone
color-Blockquotenonenone
borderLeftStyle-Admonitionnonenone
borderLeftStyle-Blockquotenonenone
borderLeftWidth-Admonitionnonenone
borderLeftWidth-Blockquotenonenone
borderRadius-Admonition$space-2$space-2
borderRadius-Blockquotenonenone
borderRight-Admonitionnonenone
borderRight-Blockquotenonenone
color-Admonitionnonenone
color-Blockquotenonenone
borderRightStyle-Admonitionnonenone
borderRightStyle-Blockquotenonenone
borderRightWidth-Admonitionnonenone
borderRightWidth-Blockquotenonenone
borderStartEndRadius-Admonitionnonenone
borderStartEndRadius-Blockquotenonenone
borderStartStartRadius-Admonitionnonenone
borderStartStartRadius-Blockquotenonenone
borderStyle-Admonitionnonenone
borderStyle-Blockquotenonenone
borderStyle-HorizontalRulenonenone
borderTop-Admonitionnonenone
borderTop-Blockquotenonenone
borderTopColor-Admonitionnonenone
borderTopColor-Blockquotenonenone
borderTopStyle-Admonitionnonenone
borderTopStyle-Blockquotenonenone
borderTopWidth-Admonitionnonenone
borderTopWidth-Blockquotenonenone
borderHorizontal-Admonitionnonenone
borderHorizontal-Blockquotenonenone
borderVerticalColor-Admonitionnonenone
borderVerticalColor-Blockquotenonenone
borderVerticalStyle-Admonitionnonenone
borderVerticalStyle-Blockquotenonenone
borderVerticalWidth-Admonitionnonenone
borderVerticalWidth-Blockquotenonenone
borderWidth-Admonitionnonenone
borderWidth-Blockquotenonenone
borderWidth-HorizontalRulenonenone
color-accent-Blockquote$color-surface-500$color-surface-500
direction-Textnonenone
fontFamily-Textnonenone
fontSize-H1-markdownnonenone
fontSize-Textnonenone
fontStretch-Textnonenone
fontStyle-Textnonenone
fontVariant-Textnonenone
fontWeight-Textnonenone
letterSpacing-Textnonenone
lineBreak-Textnonenone
lineHeight-Textnonenone
marginBottom-Admonition$space-7$space-7
marginBottom-Blockquote$space-7$space-7
marginBottom-H1-markdownnonenone
marginBottom-H2-markdownnonenone
marginBottom-H3-markdownnonenone
marginBottom-H4-markdownnonenone
marginBottom-H5-markdownnonenone
marginBottom-H6-markdownnonenone
marginBottom-HtmlLi$space-2_5$space-2_5
marginBottom-HtmlVideononenone
marginBottom-Image-markdown$space-4$space-4
marginLeft-Admonition-content$space-1_5$space-1_5
marginLeft-Image-markdown$space-0$space-0
marginRight-Image-markdown$space-0$space-0
marginTop-Admonition$space-7$space-7
marginTop-Blockquote$space-7$space-7
marginTop-H1-markdownnonenone
marginTop-H2-markdownnonenone
marginTop-H3-markdownnonenone
marginTop-H4-markdownnonenone
marginTop-H5-markdownnonenone
marginTop-H6-markdownnonenone
marginTop-HtmlLi$space-2_5$space-2_5
marginTop-HtmlVideononenone
marginTop-Image-markdown$space-4$space-4
padding-Admonitionnonenone
padding-Blockquotenonenone
paddingBottom-Admonition$space-2$space-2
paddingBottom-Blockquote$space-2_5$space-2_5
paddingBottom-Markdownnonenone
paddingHorizontal-Admonitionnonenone
paddingHorizontal-Blockquote$space-6$space-6
paddingLeft-Admonition$space-2$space-2
paddingLeft-Blockquotenonenone
paddingRight-Admonition$space-6$space-6
paddingRight-Blockquotenonenone
paddingTop-Admonition$space-3$space-3
paddingTop-Blockquote$space-3$space-3
paddingTop-Markdownnonenone
paddingVertical-Admonitionnonenone
paddingVertical-Blockquotenonenone
size-icon-Admonition$space-5$space-5
textAlign-Textnonenone
textAlignLast-Textnonenone
textColor-Textnonenone
textDecorationColor-Textnonenone
textDecorationLine-Textnonenone
textDecorationStyle-Textnonenone
textDecorationThickness-Textnonenone
textIndent-Textnonenone
textShadow-Textnonenone
textTransform-Textnonenone
textUnderlineOffset-Textnonenone
width-accent-Blockquote3px3px
wordBreak-Textnonenone
wordSpacing-Textnonenone
wordWrap-Textnonenone
writingMode-Textnonenone
This site is an XMLUI™ app.