Class that wraps the Active Markdown document used in the editor. [ComVisible] is important as we access this from JavaScript
MarkdownMonster.MarkdownDocument
public class MarkdownDocument : object, INotifyPropertyChanged
Class Members
Member | Description | |
---|---|---|
Constructor |
||
BeforeDocumentRendered |
Event that fires just before the document is rendered. It's passed the Markdown text before it is converted to HTML so you can intercept and modify the markdown before rendering. | |
DocumentRendered |
Event that fires after the final HTML document has been created when merging with a preview template. The html contains the fully rendered HTML document before it is returned or written to file. | |
IsDirtyChanged |
Event fired when the dirty changed of the document changes | |
MarkdownRendered |
Event that fires after the raw markdown has been rendered to html. Note this will be an HTML fragment not an HTML document. | |
PropertyChanged |
||
PREVIEW_HTML_FILENAME |
||
PREVIEW_HTML_SOURCE_FILENAME |
||
UNTITLED |
||
AddExtraHeaders |
Allows adding extra headers that are embedded into the HTML output file's HEAD section public void AddExtraHeaders(string extraHeaderText) |
|
AutoSaveAsync |
Creates a backup file public Task AutoSaveAsync(string filename) |
|
CleanupBackupFile |
Cleans up the backup file and removes the timer public void CleanupBackupFile(string filename) |
|
Close |
Cleans up after the file is closed by deleting the HTML render file. public void Close() |
|
GetDocumentTitle |
Tries to retrieve the title from the active document and returns the title text or as a kebab case filename. If title can't be resolved null is returned. public string GetDocumentTitle(string markdownText, bool asFilename) |
|
GetFileEncoding |
Retrieve the file encoding for a given file so we can capture and store the Encoding when writing the file back out after editing. public void GetFileEncoding(string filename) |
|
GetPreviewWebRootPath |
Sets the PreviewWebRootPath from content in the YAML of the document: webRootPath: c:\temp\post\Topic\ public string GetPreviewWebRootPath() |
|
GetWebRootPathFromMarkerFiles |
Retrieves a Web Root path that is used to resolving / and /~ in the Previewer so that related resources that site relative paths can be resolved.public string GetWebRootPathFromMarkerFiles(string basePath) |
|
GetWebRootRelativePath |
Returns a WebRoot Relative and slash normalized path for a file based on the current document's base file. Paths are converted to forward slashes as embeddable links. If path is empty or untitled path is returned as is.public string GetWebRootRelativePath(string path, string basePath) |
|
HasBackupFile |
Checks to see whether there's a backup file present public bool HasBackupFile() |
|
HasFileChanged |
Determines whether text has changed from original. public bool HasFileChanged(string currentText) |
|
HasFileCrcChanged |
Checks to see if the CRC has changed public bool HasFileCrcChanged() |
|
IsFileEncrypted |
Determines whether the file on disk is encrypted public bool IsFileEncrypted(string filename) |
|
Load |
Loads the markdown document into the CurrentText public Task |
|
OnBeforeDocumentRendered |
public void OnBeforeDocumentRendered(ref string markdown) |
|
OnDocumentRendered |
Fires after HTML has been generated from Markdown and has been merged into the template. At this point HTML contains a full HTML document. public void OnDocumentRendered(ref string html, ref string markdown) |
|
OnMarkdownRendered |
Post processing of the the rendered markdown fragment that has been turned into html (before it has been merged into the document template). public void OnMarkdownRendered(ref string html, ref string markdown) |
|
OnPropertyChanged |
public virtual void OnPropertyChanged(string propertyName) |
|
RenderHtml |
Renders markdown of the current document text into raw HTML public string RenderHtml(string markdown, bool usePragmaLines, bool noBanner) |
|
RenderHtmlToFile |
Renders markdown from the current document using the appropriate Theme Template and writing an output file. Options allow customization and can avoid writing out a file. public Task |
|
RenderHtmlWithTemplate |
Renders HTML output with the active Template to a full HTML document as a string. public Task |
|
ResolveSyntaxFromFilename |
Resolves syntax based on the filename extension. Untitled public string ResolveSyntaxFromFilename(string filename) |
|
Save |
Saves the CurrentText into the specified filename public bool Save(string filename, bool noBackupFileCleanup, SecureString password) |
|
SaveAsync |
Saves the CurrentText into the specified filename public Task public Task |
|
SetHtmlRenderFilename |
Allows you to explicitly override the render filename used for previewing. This allows addins to render out of custom folders when previewing since the previewer uses the HtmlRenderFilename. public void SetHtmlRenderFilename(string filename) |
|
StripFrontMatter |
Strips Front Matter from markdown and returns just the Markdown public static string StripFrontMatter(string markdown) |
|
ToString |
public virtual string ToString() |
|
UpdateCrc |
Stores the CRC of the file as currently exists on disk public void UpdateCrc(string filename) |
|
WriteFile |
Writes the file with a retry public bool WriteFile(string filename, string html) |
|
WriteFileAsync |
Writes the file with a retry public Task |
|
AutoSaveBackup |
Determines whether backups are automatically saved | |
AutoSaveDocument |
Determines whether documents are automatically saved in the background as soon as changes are made and you stop typing for a second. This setting takes precendence over AutoSaveBackups. | |
BackupFilename |
Name of the auto save backup file | |
CurrentText |
Holds the actively edited Markdown text | |
Dispatcher |
Window dispatcher to ensure we're synchronizing in the right context always. | |
EditorSyntax |
||
Encoding |
Document encoding used when writing the document to disk. Default: UTF-8 without a BOM | |
ExtraHtmlHeaders |
Extra HTML document headers that get get added to the document in the head section of the HTML document. |
|
FileCrc |
Holds the disk file Crc of the document. This value is used to determine if the document on disk has changed when activating a document after having navigated off and when saving. | |
Filename |
Name of the Markdown file. If this is a new file the file is named 'untitled' | |
FilenamePathWithIndicator |
Returns a filename plus path and a change indicator Used when multiple tabs with the same file are open | |
FilenameWithIndicator |
Returns the filename with a dirty indicator (*) if the document has changed | |
FilePath |
Returns the path of the open document. Null for empty or Untitled documents. | |
HtmlRenderFilename |
This is the filename used when rendering this document to HTML | |
IsActive |
Determines whether the document is the active document | |
IsDirty |
Determines whether the active document has changes that have not been saved yet | |
IsEncrypted |
Determines whether the file is encrypted | |
IsUntitled |
||
LastEditorLineNumber |
Holds the last preview window browser scroll position so it can be restored when refreshing the preview window. | |
LastImageFolder |
The last Image Folder used for this document | |
LastSaveTime |
||
OriginalText |
The original text of the document since the last save operation. Updated whenever a document is saved. | |
Password |
Holds the username and password | |
PreviewWebRootPath |
Path that maps / in the rendered document. If non-null this value is fixed up for special case translation in the HTML output. |
|
ProcessScripts |
Internal property used to identify whether scripts are processed | |
Title |
Tries to return the title from the active Markdown document by looking at: |
Requirements
Namespace: MarkdownMonsterAssembly: markdownmonster.exe
© West Wind Technologies, 2016-2024 • Updated: 11/23/21
Comment or report problem with topic