MarkdownSaveOptions Class

MarkdownSaveOptions class

Represents Markdown save options. For example, you can set markdown formatting style, use predefined GitLab Flavored Markdown compatible options and configurate resources handling. Refer to more info in article.

public class MarkdownSaveOptions : SaveOptions


MarkdownSaveOptions()Initializes a new instance of the MarkdownSaveOptions class.


static Default { get; }Returns set of options which are compatible with default Markdown documentation.
static Git { get; }Returns set of options which are compatible with GitLab Flavored Markdown.
Features { get; set; }Flag set that controls which elements are converted to markdown.
Formatter { get; set; }Gets or sets the markdown formatting style.
ResourceHandlingOptions { get; }Gets a ResourceHandlingOptions object which is used for configuration of resources handling.


You can find complete examples and data files on GitHub.


using Aspose.Html;
using Aspose.Html.Converters;
using Aspose.Html.Saving;
using System;
using System.IO;
	 // Prepare a path for converted file saving 
      string savePath = Path.Combine(OutputDir, "");

      // Prepare HTML code and save it to the file
      var code = "<h1>Header 1</h1>" +
            "<h2>Header 2</h2>" +
            "<p>Hello, World!!</p>" +
            "<a href=''>aspose</a>";
      File.WriteAllText(Path.Combine(OutputDir, "options.html"), code);

      // Create an instance of SaveOptions and set up the rule: 
      // - only <a> and <p> elements will be converted to Markdown
      var options = new MarkdownSaveOptions();
      options.Features = MarkdownFeatures.Link | MarkdownFeatures.AutomaticParagraph;

      // Call the ConvertHTML method to convert the HTML to Markdown.
      Converter.ConvertHTML(Path.Combine(OutputDir, "options.html"), options, savePath);

See Also