<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
    <!--
    * This file is part of the LibreOffice project.
    *
    * This Source Code Form is subject to the terms of the Mozilla Public
    * License, v. 2.0. If a copy of the MPL was not distributed with this
    * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    *
    -->

<meta>
    <topic id="text/swriter/guide/markdown.xhp" indexer="include" status="PUBLISH">
        <title id="tit">Markdown</title>
        <filename>/text/swriter/guide/markdown.xhp</filename>
    </topic>
</meta>
<body>
<bookmark branch="index" id="bm_id641765835594010">
    <bookmark_value>markdown;file</bookmark_value>
    <bookmark_value>file;Markdown format</bookmark_value>
    <bookmark_value>markdown;paste format</bookmark_value>
</bookmark>
<section id="markdown">
    <h1 id="hd_id581765831033457"><variable id="h1"><link href="text/swriter/guide/markdown.xhp">Working with Markdown (.md) files</link></variable></h1>
    <description id="par_id241765831033457">%PRODUCTNAME Writer can open and save files in the Markdown (.md) file format, as well as paste Markdown content in a text document.</description>
</section>
<paragraph role="paragraph" id="par_id41765833052175">Markdown is a lightweight markup language that allows you to format text using simple syntax. It is widely used for writing documentation, README files, forum posts, and even some emails.</paragraph>
<h2 id="hd_id31765836500832">Opening a Markdown file</h2>
<list type="ordered">
    <listitem><paragraph id="par_idN10897" role="listitem">Choose <menuitem>File - Open</menuitem>.</paragraph></listitem>
    <listitem>
        <paragraph id="par_idN1089F" role="listitem">Locate the Markdown file that you want to open.</paragraph>
        <paragraph id="par_idN108A2" role="listitem">If the file has a *.md extension, select the file.</paragraph>
        <paragraph id="par_idN108A5" role="listitem">If the Markdown file has another extension, select the file, and then select "Markdown Document (.md, .markdown)" in the <emph>File type</emph> box</paragraph></listitem>
    <listitem><paragraph id="par_idN1082D" role="listitem">Click <menuitem>Open</menuitem>.</paragraph></listitem>
</list>
<h2 id="hd_id401765836659571">To save a file in Markdown format</h2>
<list type="ordered">
<listitem>
<paragraph id="par_idN10901" role="listitem">Open the text document that you want to save as a Markdown file.</paragraph>
</listitem>
<listitem>
<paragraph id="par_idN10905" role="listitem">Choose <menuitem>File - Save as</menuitem>.</paragraph>
</listitem>
<listitem>
<paragraph id="par_idN10915" role="listitem">In the <menuitem>File name</menuitem> box, enter a name for the file.</paragraph>
</listitem>
<listitem>
<paragraph id="par_idN1090D" role="listitem">In the <menuitem>File type</menuitem> box, select "Markdown Document (.md)".</paragraph>
</listitem>
<listitem>
<paragraph id="par_idN107FC" role="listitem">Click <menuitem>Save</menuitem>.</paragraph>
</listitem>
</list>
<h2 id="hd_id861765837133232">Pasting Markdown content in a %PRODUCTNAME text document.</h2>
<paragraph role="paragraph" id="par_id661765839151050">You can paste Markdown content directly into a %PRODUCTNAME Writer document. Writer intelligently applies the corresponding styles, automatically assigning paragraph, list, and character formatting, using the automatic (default) styles.</paragraph>
<tip id="par_id271765841051407">You can import styles from a custom template to customize the automatic styles.</tip>
<h2 id="hd_id951765840480116">Opening a Markdown file using the command line</h2>
<paragraph role="paragraph" id="par_id471765840552211">You can open a Markdown file from the command line and automatically apply a template to generate a custom-formatted text document. Enter the following command in your operating system’s command shell to apply the template file <literal>template.ott</literal> to the file <literal>test.md</literal>:</paragraph>
<paragraph role="tablecontent" id="par_id261765835214157" localize="false"><input>soffice --infilter='Markdown:{"TemplateURL":{"type":"string","value":"./template.ott"}}' test.md</input></paragraph>
<tip id="par_id241765840493828">%PRODUCTNAME implements the <link href="https://commonmark.org/help/">CommonMark</link> Markdown specification.</tip>
<section id="relatedtopics">
    <paragraph role="paragraph" id="par_id111765839422628"><link href="https://commonmark.org/">CommonMark website</link></paragraph>
</section>

</body>
</helpdocument>
