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

Constructors

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

Properties

NameDescription
static getDefault Returns set of options which are compatible with default Markdown documentation.
static getGit Returns set of options which are compatible with GitLab Flavored Markdown.
[getFeatures]
[setFeatures] Flag set that controls which elements are converted to markdown.
[getFormatter]
[setFormatter] Gets or sets the markdown formatting style.
getResourceHandlingOptions Gets a ResourceHandlingOptions object which is used for configuration of resources handling.

Remarks

You can find complete examples and data files on GitHub.

Examples

import com.aspose.html;
import com.aspose.html.Converters;
import com.aspose.html.Saving;
import System;
import System.IO;
...
	 // Prepare a path for converted file saving 
      String savePath = Path.Combine(OutputDir, "options-output.md");

      // 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.com'>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