Class MarkdownDocument
Represents a class to maintain Markdown document.
Inheritance
Implements
Namespace: Syncfusion.Office.Markdown
Assembly: Syncfusion.Markdown.dll
Syntax
public class MarkdownDocument : Object, IDisposable
Constructors
MarkdownDocument()
Initializes a new instance of the MarkdownDocument class.
Declaration
public MarkdownDocument()
MarkdownDocument(MarkdownDocument)
Initializes a new instance of the MarkdownDocument class by cloning the specified document.
Declaration
protected MarkdownDocument(MarkdownDocument doc)
Parameters
| Type | Name | Description |
|---|---|---|
| MarkdownDocument | doc | The source MarkdownDocument to clone. |
MarkdownDocument(Stream, MdImportSettings)
Initializes new instance of the MarkdownDocument class.
Declaration
public MarkdownDocument(Stream stream, MdImportSettings mdImportSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | The stream containing Markdown data. |
| MdImportSettings | mdImportSettings | The settings used to import the Markdown data. This parameter is optional. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
MarkdownDocument(String, MdImportSettings)
Initializes new instance of the MarkdownDocument class.
Declaration
public MarkdownDocument(string fileName, MdImportSettings mdImportSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | The file name or path containing Markdown data. |
| MdImportSettings | mdImportSettings | The settings used to import the Markdown data. This parameter is optional. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
Properties
Blocks
Gets or sets list of blocks in Markdown
Declaration
public List<IMdBlock> Blocks { get; }
Property Value
| Type |
|---|
| System.Collections.Generic.List<IMdBlock> |
Methods
AddCodeBlock()
Adds the MdCodeBlock to the Markdown.
Declaration
public MdCodeBlock AddCodeBlock()
Returns
| Type | Description |
|---|---|
| MdCodeBlock | Returns new MdCodeBlock. |
AddParagraph()
Adds the MdParagraph to the Markdown.
Declaration
public MdParagraph AddParagraph()
Returns
| Type | Description |
|---|---|
| MdParagraph | The reference to the newly created paragraph. |
AddTable()
Adds the MdTable to the Markdown.
Declaration
public MdTable AddTable()
Returns
| Type | Description |
|---|---|
| MdTable | The reference to the newly created table. |
AddThematicBreak()
Adds the MdThematicBreak to the Markdown.
Declaration
public MdThematicBreak AddThematicBreak()
Returns
| Type | Description |
|---|---|
| MdThematicBreak | The reference to the newly created thematicbreak. |
Clone()
Creates a deep copy of the current MarkdownDocument.
Declaration
public MarkdownDocument Clone()
Returns
| Type | Description |
|---|---|
| MarkdownDocument | A new MarkdownDocument instance containing a cloned copy of all blocks. |
Dispose()
Disposes the document.
Declaration
public void Dispose()
GetMarkdownText(SaveOptions)
Gets markdown content as text.
Declaration
public string GetMarkdownText(SaveOptions saveOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| SaveOptions | saveOptions | The settings used to customize the Markdown output. This parameter is optional. |
Returns
| Type | Description |
|---|---|
| System.String | A string containing the serialized Markdown content. |
Open(Stream, MdImportSettings)
Parses a Markdown document from the specified stream.
Declaration
public void Open(Stream stream, MdImportSettings mdImportSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | The stream containing the Markdown content. |
| MdImportSettings | mdImportSettings | The settings used to import the Markdown content. This parameter is optional. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
Open(String, MdImportSettings)
Parses a Markdown document from the specified file path.
Declaration
public void Open(string fileName, MdImportSettings mdImportSettings = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | A string that contains the name of the file to open |
| MdImportSettings | mdImportSettings | The settings used to import the Markdown data. This parameter is optional. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
Save(Stream, SaveOptions)
Saves the Markdown document to the specified stream.
Declaration
public void Save(Stream stream, SaveOptions saveOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | The stream to which the Markdown content will be written. |
| SaveOptions | saveOptions | The settings used to customize the Markdown output. This parameter is optional. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
Save(String, SaveOptions)
Saves the Markdown document to the file system using the specified file name.
Declaration
public void Save(string fileName, SaveOptions saveOptions = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | The full path and name of the output file, including the .md extension. |
| SaveOptions | saveOptions | The settings used to customize the Markdown output. This parameter is optional. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
| System.ArgumentException | Thrown when |