主要内容

markdowndisp

R2026b

Display rendered Markdown text

Since R2026b

    Description

    markdowndisp(textToRender) renders the Markdown-formatted text in the Command Window or Live Editor.

    example

    Examples

    collapse all

    Render a string with bold and strikethrough Markdown formatting.

    markdowndisp("**bold text** normal text ~~strikethrough text~~")

    Rendered Markdown with bold text, normal text, and strikethrough text

    Render multi-line Markdown text by inserting line breaks between elements. To insert line breaks, use either the sprintf function or the newline function.

    Create and render a Markdown string containing a heading, bold labels with values, and a bulleted list. Use sprintf with \n to insert line breaks between elements.

    mdText = sprintf("## Status Report\n**Project:** Widget\n**Status:** Complete\n\n- Task A done\n- Task B done\n- Task C in progress\n");
    markdowndisp(mdText)

    Rendered status report with a heading, bold labels with values, and a bulleted list

    Create and render a Markdown string containing a table. Use newline to insert line breaks between elements.

    mdText = "| Syntax | Description |" + newline + "| ----------- | ----------- |" + newline + ...
        "| `plot(x,y)` | Create a line plot. |" + newline + "| `scatter(x,y)` | Create a scatter plot. |";
    markdowndisp(mdText)

    Rendered Markdown table with Syntax and Description columns

    Render an inline LaTeX equation.

    markdowndisp("$E=mc^2$")

    Rendered LaTeX equation E equals mc squared

    Input Arguments

    collapse all

    Markdown text to render, specified as a string scalar or character vector. Use GitHub Flavored Markdown (GFM) syntax. For more information, see https://github.github.com/gfm/.

    Each markdowndisp call must be self‑contained. To add line breaks in inline elements, use the sprintf function with newline characters (\n) or the newline function.

    The backspace character (\b) is not supported.

    Tips

    • By default, markdowndisp renders Markdown text in the Command Window. If you disable enhanced output or if MATLAB® is running with the -nodesktop or -nodisplay option, markdowndisp displays the Markdown source text instead of rendered output. For more information about enhanced output, see Show Enhanced Output in Command Window.

    Version History

    Introduced in R2026b

    See Also

    Functions