FromMarkdownString
FromMarkdownString(string, string, ExportOptions)
Converts a Markdown string to a document and saves it to a file.
public static void FromMarkdownString(string markdownContent, string outputPath,
ExportOptions options = null)
| Parameter |
Type |
Description |
| markdownContent |
String |
The Markdown content as a string. |
| outputPath |
String |
Path where the output document will be saved. |
| options |
ExportOptions |
Export options, or null to infer format from the file extension. |
Exceptions
| exception |
condition |
| GroupDocsMarkdownException |
Thrown when conversion fails. |
| NotSupportedException |
Thrown when the output format is not supported. |
Examples
string markdown = "# Hello\n\nThis is a test.";
MarkdownConverter.FromMarkdownString(markdown, "output.docx");
See Also
FromMarkdownString(string, Stream, ExportOptions)
Converts a Markdown string to a document and writes it to a stream.
public static void FromMarkdownString(string markdownContent, Stream outputStream,
ExportOptions options)
| Parameter |
Type |
Description |
| markdownContent |
String |
The Markdown content as a string. |
| outputStream |
Stream |
A writable stream that will receive the document bytes. |
| options |
ExportOptions |
Export options. Format must be set since there is no file extension to infer from. |
Exceptions
Examples
string markdown = "# Report\n\nGenerated content.";
using var stream = new MemoryStream();
MarkdownConverter.FromMarkdownString(markdown, stream, new ExportOptions(FileFormat.Docx));
See Also