Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 687 Bytes

simple-document.md

File metadata and controls

33 lines (25 loc) · 687 Bytes

Example: Create a simple markdown document

This example shows how to create a new document, add a heading and a paragraph to it and then save the document to a file:

using Grynwald.MarkdownGenerator;

public class Program
{
    static void Main()
    {
        // create the document (initially empty)
        var document = new MdDocument();

        // add a heading and a paragraph to the root block
        document.Root.Add(new MdHeading("Heading", 1));
        document.Root.Add(new MdParagraph("Hello world!"));

        // save document to a file
        document.Save("HelloWorld.md");
    }
}

This will produce the output:

# Heading

Hello world!