Skip to main content

Markdown

The Markdown component is a read-only way to display content formatted in markdown-style.

Import

import { Markdown } from '@dynatrace/strato-components/content';

Demo

YAML frontmatter

A document that starts with a YAML frontmatter block renders that block as a metadata table above the document body. This matches how common Markdown viewers present frontmatter, and makes the frontmatter easier to scan than a block of text would be.

Markdown only recognizes frontmatter at the very start of a document, delimited by a line of three hyphens before and after the block. If the block is not valid YAML, Markdown renders the document unchanged.

Customize markdown rendering

Use the customComponentMappings prop to override the default rendering behavior.

const customMappings = {
h2: ({ children }) => (<u><h2>{children}</h2></u>)
}

<Markdown customComponentMappings={customMappings}>## Test</Markdown>
Still have questions?
Find answers in the Dynatrace Community