diff --git a/Codist/Codist.csproj b/Codist/Codist.csproj index 969cea8b..029f53ad 100644 --- a/Codist/Codist.csproj +++ b/Codist/Codist.csproj @@ -87,7 +87,9 @@ + + @@ -350,6 +352,9 @@ False Lib\CLR.dll + + Lib\Markdig.dll + False @@ -357,12 +362,24 @@ + + False + Lib\System.Buffers.dll + + + False + Lib\System.Memory.dll + + + False + Lib\System.Runtime.CompilerServices.Unsafe.dll + @@ -492,6 +509,9 @@ runtime; build; native; contentfiles; analyzers all + + 1.8.30 + 2.0.0 diff --git a/Codist/Commands/CodistPackage.en-US.vsct b/Codist/Commands/CodistPackage.en-US.vsct index c3c68281..7a2b4fe4 100644 --- a/Codist/Commands/CodistPackage.en-US.vsct +++ b/Codist/Commands/CodistPackage.en-US.vsct @@ -43,6 +43,17 @@ Display file types supported by Visual Studio + + diff --git a/Codist/Commands/CodistPackage.vsct b/Codist/Commands/CodistPackage.vsct index 0a0ad25a..6a1fe9df 100644 --- a/Codist/Commands/CodistPackage.vsct +++ b/Codist/Commands/CodistPackage.vsct @@ -82,6 +82,7 @@ + @@ -91,7 +92,7 @@ - + diff --git a/Codist/Commands/CodistPackage.zh-Hans.vsct b/Codist/Commands/CodistPackage.zh-Hans.vsct index 9a9675a6..a315e1e3 100644 --- a/Codist/Commands/CodistPackage.zh-Hans.vsct +++ b/Codist/Commands/CodistPackage.zh-Hans.vsct @@ -36,6 +36,17 @@ 显示 Visual Studio 支持的文件类型 + + diff --git a/Codist/Commands/TransformDocumentCommand.cs b/Codist/Commands/TransformDocumentCommand.cs new file mode 100644 index 00000000..20b39cf9 --- /dev/null +++ b/Codist/Commands/TransformDocumentCommand.cs @@ -0,0 +1,36 @@ +using System; +using System.Windows; +using Microsoft.VisualStudio.Shell; + +namespace Codist.Commands +{ + /// A command which performs XSLT on the active code document window. + internal static class TransformDocumentCommand + { + public static void Initialize() { + if (CodistPackage.VsVersion.Major < 17) { + return; + } + Command.TransformDocument.Register(Execute, (s, args) => { + ThreadHelper.ThrowIfNotOnUIThread(); + ((OleMenuCommand)s).Visible = TextEditorHelper.GetActiveWpfDocumentView()?.TextBuffer.LikeContentType("markdown") == true; + }); + } + + static void Execute(object sender, EventArgs e) { + ThreadHelper.ThrowIfNotOnUIThread(); + var doc = CodistPackage.DTE.ActiveDocument; + if (doc == null) { + return; + } + var docWindow = TextEditorHelper.GetActiveWpfDocumentView(); + if (docWindow == null) { + return; + } + new TransformDocumentWindow(VsShellHelper.GetActiveProjectInSolutionExplorer(), docWindow.TextSnapshot, doc.FullName) { + Owner = Application.Current.MainWindow, + WindowStartupLocation = WindowStartupLocation.CenterOwner + }.ShowDialog(); + } + } +} diff --git a/Codist/Commands/TransformDocumentWindow.cs b/Codist/Commands/TransformDocumentWindow.cs new file mode 100644 index 00000000..60efe2f2 --- /dev/null +++ b/Codist/Commands/TransformDocumentWindow.cs @@ -0,0 +1,392 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Xml; +using System.Xml.Xsl; +using Codist.Controls; +using Markdig; +using Markdig.Syntax; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Text; +using Sgml; +using R = Codist.Properties.Resources; +using P = EnvDTE.Project; +using WinForm = System.Windows.Forms; +using Newtonsoft.Json; +using System.Diagnostics; + +namespace Codist.Commands +{ + sealed class TransformDocumentWindow : Window + { + readonly P _Project; + readonly ThemedTipText _TipText; + readonly Dictionary _Settings; + readonly TransformSettings _CurrentSettings; + readonly string _ConfigPath, _ProjectPath, _SourcePath, _BasePath, _SourceName; + readonly ITextSnapshot _SourceText; + readonly TextBox _SourceBox, _TargetBox, _XsltBox; + readonly Button _BrowseTargetButton, _BrowseXsltButton, _TransformButton, _CancelButton; + readonly RadioButton _SaveHtmlFragmentButton, _SaveHtmlDocumentButton, _XsltTransformButton; + readonly ComboBox _EncodingBox; + + [SuppressMessage("Usage", Suppression.VSTHRD010, Justification = Suppression.CheckedInCaller)] + public TransformDocumentWindow(P project, ITextSnapshot source, string sourcePath) { + _Project = project; + _SourceText = source; + _SourcePath = sourcePath; + (_BasePath, _SourceName) = FileHelper.DeconstructPath(sourcePath); + _SourceName = _SourceName != null ? Path.GetFileNameWithoutExtension(_SourceName) : String.Empty; + if (project != null) { + _ProjectPath = project.FullName; + _ConfigPath = TransformSettings.GetConfigPath(project); + } + else { + _ProjectPath = _BasePath; + _ConfigPath = TransformSettings.GetConfigPath(_BasePath); + } + Title = "Transform Document"; + ShowInTaskbar = false; + SnapsToDevicePixels = true; + ResizeMode = ResizeMode.NoResize; + SizeToContent = SizeToContent.WidthAndHeight; + Content = new Grid { + Margin = WpfHelper.MiddleMargin, + ColumnDefinitions = { + new ColumnDefinition { Width = GridLength.Auto }, + new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, + new ColumnDefinition { Width = new GridLength(100, GridUnitType.Pixel) } + }, + RowDefinitions = { + new RowDefinition { Height = GridLength.Auto }, + new RowDefinition { Height = GridLength.Auto }, + new RowDefinition { Height = GridLength.Auto }, + new RowDefinition { Height = GridLength.Auto }, + new RowDefinition { Height = GridLength.Auto }, + new RowDefinition { Height = GridLength.Auto }, + new RowDefinition { Height = GridLength.Auto }, + }, + Children = { + new Label { Content = "Source document:" }.ReferenceStyle(VsResourceKeys.ThemedDialogLabelStyleKey), + new ThemedTextBox { Text = sourcePath, Margin = WpfHelper.MiddleMargin, IsReadOnly = true, MaxWidth = 600 }.Set(ref _SourceBox).SetProperty(Grid.ColumnProperty, 1).SetProperty(Grid.ColumnSpanProperty, 2), + + new Label { Content = "Target document:" }.ReferenceStyle(VsResourceKeys.ThemedDialogLabelStyleKey).SetProperty(Grid.RowProperty, 1), + new ThemedTextBox { Text = _SourceName + ".html", Margin = WpfHelper.MiddleMargin }.Set(ref _TargetBox).SetProperty(Grid.RowProperty, 1).SetProperty(Grid.ColumnProperty, 1), + new ThemedButton (R.CMD_Browse, "Browse save location of the output document.", BrowseOutputDocument) { Width = 80, Margin = WpfHelper.MiddleMargin }.Set(ref _BrowseTargetButton).SetProperty(Grid.RowProperty, 1).SetProperty(Grid.ColumnProperty, 2), + + new Label { Content = "Transform mode:" }.ReferenceStyle(VsResourceKeys.ThemedDialogLabelStyleKey).SetProperty(Grid.RowProperty, 2), + new WrapPanel { + Orientation = Orientation.Horizontal, + VerticalAlignment = VerticalAlignment.Center, + Margin = WpfHelper.MiddleMargin, + Children = { + new RadioButton { Content = "HTML Document", IsChecked = true, GroupName = "Mode", MinWidth = 100, Margin = WpfHelper.SmallHorizontalMargin }.Set(ref _SaveHtmlDocumentButton).ReferenceStyle(VsResourceKeys.ThemedDialogRadioButtonStyleKey), + new RadioButton { Content = "HTML Fragment", GroupName = "Mode", MinWidth = 100, Margin = WpfHelper.SmallHorizontalMargin }.Set(ref _SaveHtmlFragmentButton).ReferenceStyle(VsResourceKeys.ThemedDialogRadioButtonStyleKey), + new RadioButton { Content = "XSLT", GroupName = "Mode", MinWidth = 100, Margin = WpfHelper.SmallHorizontalMargin }.Set(ref _XsltTransformButton).ReferenceStyle(VsResourceKeys.ThemedDialogRadioButtonStyleKey), + } + }.SetProperty(Grid.RowProperty, 2).SetProperty(Grid.ColumnProperty, 1).SetProperty(Grid.ColumnSpanProperty, 2), + + new Label { Content = "XSLT document:" }.ReferenceStyle(VsResourceKeys.ThemedDialogLabelStyleKey).SetProperty(Grid.RowProperty, 3), + new ThemedTextBox { Margin = WpfHelper.MiddleMargin }.Set(ref _XsltBox).SetProperty(Grid.RowProperty, 3).SetProperty(Grid.ColumnProperty, 1), + new ThemedButton (R.CMD_Browse, "Browse location of XSLT document.", BrowseXsltDocument){ Width = 80, Margin = WpfHelper.MiddleMargin }.Set (ref _BrowseXsltButton).SetProperty(Grid.RowProperty, 3).SetProperty(Grid.ColumnProperty, 2), + + new Label { Content = "Output file encoding:" }.ReferenceStyle(VsResourceKeys.ThemedDialogLabelStyleKey).SetProperty(Grid.RowProperty, 4), + new ComboBox { Items = { "UTF-8", "System Encoding (ANSI)", "Unicode", "GB 18030" }, SelectedIndex = 0, HorizontalAlignment = HorizontalAlignment.Left, MinWidth = 200, Margin = WpfHelper.MiddleMargin }.ReferenceStyle(VsResourceKeys.ComboBoxStyleKey).Set(ref _EncodingBox).SetProperty(Grid.RowProperty, 4).SetProperty(Grid.ColumnProperty, 1), + + new StackPanel { + Orientation = Orientation.Horizontal, + Margin = WpfHelper.MiddleMargin, + Children = { + new ThemedButton(R.CMD_OK, null, DoTransform) { IsDefault = true, MinWidth = 80, Margin = WpfHelper.MiddleMargin }, + new ThemedButton(R.CMD_Cancel, null, Close) { IsCancel = true, MinWidth = 80, Margin = WpfHelper.MiddleMargin }, + new ThemedButton("Save settings", "Save current settings for next time", SaveSettings) { MinWidth = 80, Margin = WpfHelper.MiddleMargin }, + } + }.SetProperty(Grid.ColumnSpanProperty, 2).SetProperty(Grid.ColumnProperty, 1).SetProperty(Grid.RowProperty, 5), + + new ThemedTipText() { MaxWidth = 600 }.SetProperty(Grid.ColumnSpanProperty, 3).SetProperty(Grid.RowProperty, 6).Set(ref _TipText) + } + }.ReferenceProperty(TextBlock.ForegroundProperty, VsBrushes.ToolWindowTextKey); + this.ReferenceProperty(Border.BackgroundProperty, VsBrushes.ToolWindowBackgroundKey); + _XsltBox.IsEnabled = _BrowseXsltButton.IsEnabled = false; + _XsltTransformButton.Checked += (s, args) => _XsltBox.IsEnabled = _BrowseXsltButton.IsEnabled = true; + _XsltTransformButton.Unchecked += (s, args) => _XsltBox.IsEnabled = _BrowseXsltButton.IsEnabled = false; + + _Settings = TransformSettings.Load(_ConfigPath) ?? new Dictionary(StringComparer.OrdinalIgnoreCase); + if (_Settings.TryGetValue(PackageUtilities.MakeRelative(_ConfigPath, _SourcePath), out _CurrentSettings)) { + LoadSettings(); + } + } + + void LoadSettings() { + var s = _CurrentSettings; + _TargetBox.Text = s.TargetFile; + _XsltBox.Text = s.XsltFile; + switch (s.Mode) { + case 0: _SaveHtmlDocumentButton.IsChecked = true; break; + case 1: _SaveHtmlFragmentButton.IsChecked = true; break; + case 2: _XsltTransformButton.IsChecked = true; break; + } + if (s.TargetEncoding < _EncodingBox.Items.Count) { + _EncodingBox.SelectedIndex = s.TargetEncoding; + } + } + + void SaveSettings() { + var s = MakeSettings(); + try { + var k = PackageUtilities.MakeRelative(_ConfigPath, _SourcePath); + if (_Settings.ContainsKey(k) == false || s != _CurrentSettings) { + _Settings[k] = s; + File.WriteAllText(_ConfigPath, JsonConvert.SerializeObject(_Settings, Newtonsoft.Json.Formatting.None, new Newtonsoft.Json.Converters.StringEnumConverter())); + _TipText.Text = "Settings saved to \"\".".Replace("", _ConfigPath); + } + } + catch (Exception ex) { + MessageWindow.Error(ex, "Failed to save config file to ".Replace("", _ConfigPath), null); + } + } + + TransformSettings MakeSettings() { + return new TransformSettings { + TargetFile = _TargetBox.Text, + XsltFile = _XsltBox.Text, + Mode = _SaveHtmlDocumentButton.IsChecked == true ? 0 : + _SaveHtmlFragmentButton.IsChecked == true ? 1 : + _SaveHtmlFragmentButton.IsChecked == true ? 2 : 0, + TargetEncoding = _EncodingBox.SelectedIndex, + }; + } + + void BrowseXsltDocument() { + using (var f = new WinForm.OpenFileDialog { + Filter = "XSLT Documents|*.xslt;*.xsl", + AddExtension = true, + Title = "Specify location of XSLT document", + InitialDirectory = _BasePath, + FileName = _SourceName + ".xslt", + ValidateNames = true, + }) { + if (f.ShowDialog() == WinForm.DialogResult.OK) { + _XsltBox.Text = PackageUtilities.MakeRelative(_SourcePath, f.FileName); + } + } + } + + void BrowseOutputDocument() { + using (var f = new WinForm.SaveFileDialog { + Filter = R.F_Html, + AddExtension = true, + Title = R.T_SpecifyLocation, + InitialDirectory = _BasePath, + FileName = _SourceName + ".html", + ValidateNames = true, + }) { + if (f.ShowDialog() == WinForm.DialogResult.OK) { + _TargetBox.Text = PackageUtilities.MakeRelative(_SourcePath, f.FileName); + } + } + } + + void DoTransform() { + try { + var md = Markdown.Parse(_SourceText.GetText(), new MarkdownPipelineBuilder().UseAdvancedExtensions().Build()); + if (_TargetBox.Text.Length == 0) { + ExportToNewWindow(md); + return; + } + var t = Path.Combine(_BasePath, _TargetBox.Text); + if (_SaveHtmlFragmentButton.IsChecked == true) { + SaveHtmlFragment(md, t); + } + else if (_SaveHtmlDocumentButton.IsChecked == true) { + SaveHtmlDocument(md, t); + } + else { + if (File.Exists(_XsltBox.Text) == false) { + MessageWindow.Error("XSLT file does not exist."); + return; + } + TransformHtmlDocument(md, t); + } + } + catch (Exception ex) { + MessageWindow.Error(ex, R.T_TransformFailed.Replace("", _SourcePath), null, new Source()); + return; + } + //if (_Project != null) { + // SaveSettings(); + //} + Close(); + } + + private void ExportToNewWindow(MarkdownDocument md) { + var w = CodistPackage.DTE.ItemOperations.NewFile("General\\HTML Page", _SourceName); + var view = w.Document.GetActiveWpfDocumentView(); + using (var edit = view.TextBuffer.CreateEdit()) { + edit.Replace(new Span(0, view.TextSnapshot.Length), md.ToHtml()); + edit.Apply(); + } + w.Document.Saved = true; + } + + void SaveHtmlFragment(MarkdownDocument md, string targetPath) { + File.WriteAllText(targetPath, md.ToHtml(), GetEncoding()); + } + + void SaveHtmlDocument(MarkdownDocument md, string targetPath) { + var html = TransformToHtml(md); + using (var xw = XmlWriter.Create(targetPath, new XmlWriterSettings { + OmitXmlDeclaration = true, + Indent = true, + IndentChars = "\t", + Encoding = GetEncoding(), + })) { + xw.WriteDocType("html", null, null, null); + html.Save(xw); + } + } + + XmlDocument TransformToHtml(MarkdownDocument md) { + var html = new XmlDocument(); + var root = html.AppendChild(html.CreateElement("html")); + var head = root.AppendChild(html.CreateElement("head")); + var meta = html.CreateElement("meta"); + meta.SetAttribute("charset", GetEncoding().WebName); + head.AppendChild(meta); + head.AppendChild(html.CreateElement("title")).InnerText = _SourceName; + var body = root.AppendChild(html.CreateElement("body")); + using (var ms = new MemoryStream()) + using (var w = new StreamWriter(ms, Encoding.UTF8)) { + md.ToHtml(w); + w.Flush(); + ms.Position = 0; + using (var r = new StreamReader(ms, Encoding.UTF8)) { + var sgml = new SgmlReader(new XmlReaderSettings { + ConformanceLevel = ConformanceLevel.Fragment, + ValidationType = ValidationType.None + }) { + IgnoreDtd = true, + StripDocType = true, + InputStream = r, + WhitespaceHandling = WhitespaceHandling.Significant + }; + var nav = body.CreateNavigator(); + while (sgml.ReadState < ReadState.Error) { + nav.AppendChild(sgml); + } + } + } + return html; + } + + void TransformHtmlDocument(MarkdownDocument md, string targetPath) { + var html = TransformToHtml(md); + var xslt = new XslCompiledTransform(); + try { + xslt.Load(_XsltBox.Text); + } + catch (XmlException ex) { + MessageWindow.Error("XSLT document is malformed: " + ex.Message); + return; + } + catch (XsltException ex) { + MessageWindow.Error("XSLT document is invalid: " + ex.Message); + return; + } + using (var xw = XmlWriter.Create(targetPath, new XmlWriterSettings { + OmitXmlDeclaration = true, + Indent = true, + IndentChars = "\t", + Encoding = GetEncoding(), + })) { + xslt.Transform(html, xw); + } + } + + Encoding GetEncoding() { + switch (_EncodingBox.SelectedIndex) { + case 1: return Encoding.Default; + case 2: return Encoding.Unicode; + case 3: return Encoding.GetEncoding("GB18030"); + default: return Encoding.UTF8; + } + } + + struct TransformSettings : IEquatable + { + public string TargetFile { get; set; } + public int Mode { get; set; } + public string XsltFile { get; set; } + public int TargetEncoding { get; set; } + + public static string GetConfigPath(P project) { + ThreadHelper.ThrowIfNotOnUIThread(); + return Path.Combine(Path.GetDirectoryName(project.FullName), "obj", project.Name + ".transform.json"); + } + public static string GetConfigPath(string basePath) { + return Path.Combine(basePath, "codist.transform.json"); + } + public static Dictionary Load(string configPath) { + try { + var d = File.Exists(configPath) + ? JsonConvert.DeserializeObject>(File.ReadAllText(configPath), new JsonSerializerSettings { + DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, + NullValueHandling = NullValueHandling.Ignore, + Error = (sender, args) => { + args.ErrorContext.Handled = true; // ignore json error + } + }) + : null; + if (d != null) { + var r = new Dictionary(StringComparer.OrdinalIgnoreCase); + foreach (var item in d) { + r[item.Key] = item.Value; + } + return r; + } + return null; + } + catch (Exception ex) { + Debug.Write("Error loading " + nameof(TransformSettings) + " from " + configPath); + Debug.WriteLine(ex.ToString()); + return null; + } + } + + public bool Equals(TransformSettings other) { + return this == other; + } + + public override bool Equals(object obj) { + return obj is TransformSettings t && this == t; + } + + public override int GetHashCode() { + int hashCode = 1143690159; + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(TargetFile); + hashCode = hashCode * -1521134295 + Mode.GetHashCode(); + hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(XsltFile); + hashCode = hashCode * -1521134295 + TargetEncoding.GetHashCode(); + return hashCode; + } + + public static bool operator == (TransformSettings x, TransformSettings y) { + return !(x != y); + } + + public static bool operator != (TransformSettings x, TransformSettings y) { + return x.TargetFile != y.TargetFile + || x.Mode != y.Mode + || x.TargetEncoding != y.TargetEncoding + || x.XsltFile != y.XsltFile; + } + } + + struct Source { } + } +} diff --git a/Codist/Helpers/TextEditorHelper.cs b/Codist/Helpers/TextEditorHelper.cs index dc01dffa..20a4fa16 100644 --- a/Codist/Helpers/TextEditorHelper.cs +++ b/Codist/Helpers/TextEditorHelper.cs @@ -1252,6 +1252,10 @@ public static bool MayBeEditor(this ITextBuffer textBuffer) { public static ITextDocument GetTextDocument(this ITextBuffer textBuffer) { return textBuffer.Properties.TryGetProperty(typeof(ITextDocument), out var d) ? d : null; } + public static string GetText(this ITextBuffer textBuffer) { + return textBuffer.CurrentSnapshot.GetText(); + } + public static string GetText(this ITextBuffer textBuffer, int start, int end) { var e = textBuffer.CurrentSnapshot.Length; if (start >= e) { diff --git a/Codist/Lib/Markdig.dll b/Codist/Lib/Markdig.dll new file mode 100644 index 00000000..4c10b342 Binary files /dev/null and b/Codist/Lib/Markdig.dll differ diff --git a/Codist/Lib/Markdig.xml b/Codist/Lib/Markdig.xml new file mode 100644 index 00000000..2149d379 --- /dev/null +++ b/Codist/Lib/Markdig.xml @@ -0,0 +1,6625 @@ + + + + Markdig + + + + + An abbreviation object stored at the document level. See extension methods in . + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Gets or sets the label. + + + + + The text associated to this label. + + + + + The label span + + + + + Extension to allow abbreviations. + + + + + + Extension methods for . + + + + + The inline abbreviation. + + + + + + Initializes a new instance of the class. + + The abbreviation. + + + + A block parser for abbreviations. + + + + + + Initializes a new instance of the class. + + + + + A HTML renderer for a . + + + + + + A block representing an alert quote block. + + + + + Creates a new instance of this block. + + + + + + Gets or sets the kind of the alert block (e.g `NOTE`, `TIP`, `IMPORTANT`, `WARNING`, `CAUTION`) + + + + + Gets or sets the trivia space after the kind. + + + + + A HTML renderer for a . + + + + + + Creates a new instance of this renderer. + + + + + Gets of sets a delegate to render the kind of the alert. + + + + + + + + Renders the kind of the alert. + + The HTML renderer. + The kind of the alert to render + + + + Extension for adding alerts to a Markdown pipeline. + + + + + Gets or sets the delegate to render the kind of the alert. + + + + + + + + + + + An inline parser for an alert inline (e.g. `[!NOTE]`). + + + + + + Initializes a new instance of the class. + + + + + The auto-identifier extension + + + + + + Initializes a new instance of the class. + + The options. + + + + Process on a new + + The processor. + The heading block. + + + + Callback when there is a reference to found to a heading. + Note that reference are only working if they are declared after. + + + + + Process the inlines of the heading to create a unique identifier + + The processor. + The inline. + + + + Options for the . + + + + + No options: does not apply any additional formatting and/or transformations. + + + + + Default () + + + + + Allows to link to a header by using the same text as the header for the link label. Default is true + + + + + Allows only ASCII characters in the url (HTML 5 allows to have UTF8 characters). Default is true + + + + + Renders auto identifiers like GitHub. + + + + + A link reference definition to a stored at the level. + + + + + + Gets or sets the heading related to this link reference definition. + + + + + Extension to automatically create when a link url http: or mailto: is found. + + + + + + Extension to automatically create when a link url http: or mailto: is found. + + + + + + Should the link open in a new window when clicked (false by default) + + + + + Should a www link be prefixed with https:// instead of http:// (false by default) + + + + + The inline parser used to for autolinks. + + + + + + Initializes a new instance of the class. + + + + + Extension for tagging some HTML elements with bootstrap classes. + + + + + + Extension for cite ""..."" + + + + + + A block custom container. + + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Extension to allow custom containers. + + + + + + An inline custom container + + + + + + + The block parser for a . + + + + + + Initializes a new instance of the class. + + + + + A HTML renderer for a . + + + + + + A HTML renderer for a . + + + + + + A definition item contains zero to multiple + and definitions (any ) + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Gets or sets the opening character for this definition item (either `:` or `~`) + + + + + A definition list contains children. + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Extension to allow definition lists + + + + + + The block parser for a . + + + + + + Initializes a new instance of the class. + + + + + A definition term contains a single line with the term to define. + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + A HTML renderer for , and . + + + + + + Extension to allow diagrams. + + + + + + Extension to allow emoji shortcodes and smileys replacement. + + + + + + An emoji inline. + + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The content. + + + + Gets or sets the original match string (either an emoji shortcode or a text smiley) + + + + + An emoji shortcodes and smileys mapping, to be used by . + + + + + The default emoji shortcodes and smileys mapping. + + + + + The default emoji shortcodes mapping, without smileys. + + + + + Returns a new instance of the default emoji shortcode to emoji unicode dictionary. + It can be used to create a customized . + + + + + Gets a new instance of the default smiley to emoji shortcode dictionary. + It can be used to create a customized . + + + + + Constructs a mapping for the default emoji shortcodes and smileys. + + + + + Constructs a mapping from a dictionary of emoji shortcodes to unicode, and a dictionary of smileys to emoji shortcodes. + + + + + The inline parser used for emojis. + + + + + + Initializes a new instance of the class. + + + + + Extension for strikethrough, subscript, superscript, inserted and marked. + + + + + + Initializes a new instance of the class. + + The options. + + + + Gets the options. + + + + + Options for enabling support for extra emphasis. + + + + + Allows all extra emphasis (default). + + + + + A text that can be strikethrough using the double character ~~ + + + + + A text that can be rendered as a subscript using the character ~ + + + + + A text that can be rendered as a superscript using the character ^ + + + + + A text that can be rendered as inserted using the double character ++ + + + + + A text that can be rendered as marked using the double character == + + + + + Defines a figure container. + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Gets or sets the opening character count used to open this figure code block. + + + + + Gets or sets the opening character used to open and close this figure code block. + + + + + The block parser for a block. + + + + + + Initializes a new instance of the class. + + + + + Defines a figure caption. + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Extension to allow usage of figures and figure captions. + + + + + + A HTML renderer for a . + + + + + + A HTML renderer for a . + + + + + + A block element for a footer. + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Gets or sets the opening character used to match this footer (by default it is ^) + + + + + A block parser for a . + + + + + + Initializes a new instance of the class. + + + + + Extension that provides footer. + + + + + + A HTML renderer for a . + + + + + + A block for a footnote. + + + + + + Gets or sets the label used by this footnote. + + + + + Gets or sets the order of this footnote (determined by the order of the in the document) + + + + + Gets the links referencing this footnote. + + + + + The label span + + + + + Extension to allow footnotes. + + + + + + A block that contains all the footnotes at the end of a . + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + A inline link to a . + + + + + + Gets or sets a value indicating whether this instance is back link (from a footnote to the link) + + + + + Gets or sets the global index number of this link. + + + + + Gets or sets the footnote this link refers to. + + + + + A link reference definition stored at the level. + + + + + + Gets or sets the footnote related to this link reference definition. + + + + + The block parser for a . + + + + + + The key used to store at the document level the pending + + + + + Add footnotes to the end of the document + + The processor. + The inline. + + + + A HTML renderer for a . + + + + + + Initializes a new instance of the class. + + + + + Gets or sets the CSS group class used when rendering the <div> of this instance. + + + + + A HTML renderer for a . + + + + + + Extension that allows to attach HTML attributes to the previous or current . + This extension should be enabled last after enabling other extensions. + + + + + + An inline parser used to parse a HTML attributes that can be attached to the previous or current . + + + + + + Initializes a new instance of the class. + + + + + Tries to extra from the current position of a slice an HTML attributes {...} + + The slice to parse. + The output attributes or null if not found or invalid + true if parsing the HTML attributes was successful + + + + Extension to add support for RTL content. + + + + + Extension to generate hardline break for softline breaks. + + + + + + Model for a JIRA link item + + + + + JIRA Project Key + + + + + JIRA Issue Number + + + + + Simple inline parser extension for Markdig to find, and + automatically add links to JIRA issue numbers. + + + + + Finds and replaces JIRA links inline + + + + + Available options for replacing JIRA links + + + + + The base Url (e.g. `https://mycompany.atlassian.net`) + + + + + The base path after the base url (default is `/browse`) + + + + + Should the link open in a new window when clicked + + + + + Gets the full url composed of the and with no trailing `/` + + + + + Extension for adding new type of list items (a., A., i., I.) + + + + + + Parser that adds supports for parsing alpha/roman list items (e.g: `a)` or `a.` or `ii.` or `II.`) + + + Note that we don't validate roman numbers. + + + + + + Initializes a new instance of the class. + + + + + A HTML renderer for a . + + + + + + A HTML renderer for a . + + + + + + A math block. + + + + + + Initializes a new instance of the class. + + The parser. + + + + The block parser for a . + + + + + + Initializes a new instance of the class. + + + + + Extension for adding inline mathematics $...$ + + + + + + A math inline element. + + + + + + Gets or sets the delimiter character used by this code inline. + + + + + Gets or sets the delimiter count. + + + + + The content as a . + + + + + An inline parser for . + + + + + + + Initializes a new instance of the class. + + + + + Gets or sets the default class to use when creating a math inline block. + + + + + Create a with delegate handler. + + Prefix of host that can be handled. + Handler that generate iframe url, if uri cannot be handled, it can return . + Should the generated iframe has allowfullscreen attribute. + "class" attribute of generated iframe. + A with delegate handler. + + + + Provides url for media links. + + + + + "class" attribute of generated iframe. + + + + + Generate url for iframe. + + Input media uri. + if is a schema relative uri, i.e. uri starts with "//". + Generated url for iframe. + + + + + Should the generated iframe has allowfullscreen attribute. + + + Should be false for audio embedding. + + + + + Extension for extending image Markdown links in case a video or an audio file is linked and output proper link. + + + + + + Options for the . + + + + + Extension that will disable URI escape with % characters for non-US-ASCII characters in order to workaround a bug under IE/Edge with local file links containing non US-ASCII chars. DO NOT USE OTHERWISE. + + + + + Extension to automatically render rel=nofollow to all links in an HTML output. + + + + + Extension to a span for each line containing the original line id (using id = pragma-line#line_number_zero_based) + + + + + + Extension to enable SelfPipeline, to configure a Markdown parsing/convertion to HTML automatically + from an embedded special tag in the input text <!--markdig:extensions--> where extensions is a string + that specifies the extensions to use for the pipeline as exposed by extension method + on the . This extension will invalidate all other extensions and will override them. + + + + + Initializes a new instance of the class. + + The matching start tag. + The default extensions. + Tag cannot contain angle brackets + + + + Gets the default pipeline to configure if no tag was found in the input text. Default is null (core pipeline). + + + + + Gets the self pipeline hint tag start that will be matched. + + + + + Creates a pipeline automatically configured from an input markdown based on the presence of the configuration tag. + + The input text. + The pipeline configured from the input + + + + + A HTML renderer for a . + + + + + + Initializes a new instance of the class. + + The options. + + + + + An inline for SmartyPant. + + + + + Converts this instance to a literal text. + + + + + + The options used for . + + + + + Initializes a new instance of the class. + + + + + Gets the mapping between a and its textual representation + (usually an HTML entity). + + + + + Extension to enable SmartyPants. + + + + + Initializes a new instance of the class. + + The options. + + + + Gets the options. + + + + + The inline parser for SmartyPants. + + + + + Initializes a new instance of the class. + + + + + Types of a . + + + + + This is a single quote ' + + + + + This is a left single quote ' -gt; lsquo; + + + + + This is a right single quote ' -gt; rsquo; + + + + + This is a double quote " + + + + + This is a left double quote " -gt; ldquo; + + + + + This is a right double quote " -gt; rdquo; + + + + + This is a right double quote << -gt; laquo; + + + + + This is a right angle quote >> -gt; raquo; + + + + + This is an ellipsis ... -gt; hellip; + + + + + This is a ndash -- -gt; ndash; + + + + + This is a mdash --- -gt; mdash; + + + + + Extension that allows to use grid tables. + + + + + + Internal state used by the + + + + + Internal state used by the + + + + + Gets or sets the index position of this column (after the |) + + + + + A HTML renderer for a + + + + + + This block parsers for pipe tables is used to by-pass list items that could start by a single '-' + and would disallow to detect a pipe tables at inline parsing time, so we are basically forcing a line + that starts by a '-' and have at least a '|' (and have optional spaces) and is a continuation of a + paragraph. + + + + + + Initializes a new instance of the class. + + + + + The delimiter used to separate the columns of a pipe table. + + + + + + Gets or sets the index of line where this delimiter was found relative to the current block. + + + + + Extension that allows to use pipe tables. + + + + + + Initializes a new instance of the class. + + The options. + + + + Gets the options. + + + + + Options for the extension + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether to require header separator. true by default (Kramdown is using false) + + + + + Defines whether table should be normalized to the amount of columns as defined in the table header. + false by default + + If true, this will insert empty cells in rows with fewer tables than the header row and remove cells + that are exceeding the header column count. + If false, this will use the row with the most columns to determine how many cells should be inserted + in all other rows (default behavior). + + + + + The inline parser used to transform a into a at inline parsing time. + + + + + + + Initializes a new instance of the class. + + The line break parser to use + The options. + + + + Gets the options. + + + + + Defines a table that contains an optional . + + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Gets or sets the column alignments. May be null. + + + + + Checks if the table structure is valid. + + True if the table has rows and the number of cells per row is correct, other wise false. + + + + Normalizes the number of columns of this table by taking the maximum columns and appending empty cells. + + + + + Normalizes the number of columns of this table by taking the amount of columns defined in the header + and appending empty cells or removing extra cells as needed. + + + + + Defines a cell in a + + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Gets or sets the index of the column to which this cell belongs. + + + + + Gets or sets the column span this cell is covering. Default is 1. + + + + + Gets or sets the row span this cell is covering. Default is 1. + + + + + Gets or sets whether this cell can be closed. + + + + + Defines the alignment of a column + + + + + Align the column to the left + + + + + Align the column to the center + + + + + Align the column to the right + + + + + Defines a column. + + + + + Gets or sets the width (in percentage) of this column. A value of 0 is unspecified. + + + + + Gets or sets the column alignment. + + + + + Helper methods for parsing tables. + + + + + Parses a column header equivalent to the regexp: \s*:\s*[delimiterChar]+\s*:\s* + + The text slice. + The delimiter character (either `-` or `=`). + The alignment of the column. + + true if parsing was successful + + + + + Parses a column header equivalent to the regexp: \s*:\s*[delimiterChar]+\s*:\s* + + The text slice. + The delimiter character (either `-` or `=`). + The alignment of the column. + + true if parsing was successful + + + + + Parses a column header equivalent to the regexp: \s*:\s*[delimiterChar]+\s*:\s* + + The text slice. + The delimiter character (either `-` or `=`). If `\0`, it will detect the character (either `-` or `=`) + The alignment of the column. + + true if parsing was successful + + + + + Defines a row in a , contains , parent is . + + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether this instance is header row. + + + + + A HTML renderer for a . + + + + + + An inline for TaskList. + + + + + Extension to enable TaskList. + + + + + The inline parser for SmartyPants. + + + + + Initializes a new instance of the class. + + + + + Gets or sets the list class used for a task list. + + + + + Gets or sets the list item class used for a task list. + + + + + Extension that allows setting line-endings for any IMarkdownRenderer + that inherits from + + + + + + A YAML frontmatter block. + + + + + + Initializes a new instance of the class. + + The parser. + + + + Extension to discard a YAML frontmatter at the beginning of a Markdown document. + + + + + Allows the to appear in the middle of the markdown file. + + + + + Empty renderer for a + + + + + + Block parser for a YAML frontmatter. + + + + + + Allows the to appear in the middle of the markdown file. + + + + + Initializes a new instance of the class. + + + + + Creates the front matter block. + + The block processor + The front matter block + + + + Tries to match a block opening. + + The parser processor. + The result of the match + + + + Tries to continue matching a block already opened. + + The parser processor. + The block already opened. + The result of the match. By default, don't expect any newline + + + + Allows to associate characters to a data structures and query efficiently for them. + + + + + + Initializes a new instance of the class. + + The states. + + + + + Gets all the opening characters defined. + + + + + Gets the list of parsers valid for the specified opening character. + + The opening character. + A list of parsers valid for the specified opening character or null if no parsers registered. + + + + Searches for an opening character from a registered parser in the specified string. + + The text. + The start. + The end. + Index position within the string of the first opening character found in the specified text; if not found, returns -1 + + + + Helper class for handling characters. + + + + + Class used to simplify a unicode char to a simple ASCII string + + + + + Converts a unicode char to a simple ASCII string. + + The input char. + The simple ASCII string or null if the char itself cannot be simplified + + + + A compact insert-only key/value collection for fast prefix lookups + Something between a Trie and a full Radix tree, but stored linearly in memory + + The value associated with the key + + + + Used internally to control behavior of insertion + Copied from internals + + + + + The default insertion behavior. Does not overwrite or throw. + + + + + Specifies that an existing entry with the same key should be overwritten if encountered. + + + + + Specifies that if an existing entry with the same key is encountered, an exception should be thrown. + + + + + The character this node represents, should never be 0 + + + + + Will be 0 if this is a leaf node + + + + + Set to -1 if it does not point to a match + + + + + -1 if not present + + + + + Gets the number of nodes in the internal tree structure + You might be looking for + Exposing this might help in deducing more efficient initial parameters + + + + + Gets or sets the capacity of the internal tree structure buffer + You might be looking for + + + + + Gets the number of key/value pairs contained in the + + + + + Gets or sets the capacity of the internal key/value pair buffer + + + + + Gets the size of the children buffer in the internal tree structure + You might be looking for + Exposing this might help in deducing more efficient initial parameters + + + + + Gets or sets the capacity of the internal children buffer + You might be looking for + + + + + Constructs a new with no initial prefixes + + + + + Constructs a new with the supplied matches + + Matches to initialize the with. For best lookup performance, this collection should be sorted. + + + + Retrieves the key/value pair at the specified index (must be lower than ) + + Index of pair to get, must be lower than (the order is the same as the order in which the elements were added) + The key/value pair of the element at the specified index + + + + Gets or sets the value associated with the specified key + + The key of the value to get or set + The value of the element with the specified key + + + + Gets the value associated with the specified key + + The key of the value to get + The key/value pair of the element with the specified key + + + + Adds the specified key/value pair to the + + The key of the element to add + The value of the element to add + + + + Adds the specified key/value pair to the + + The key/value pair to add + + + + Tries to add the key/value pair to the if the key is not yet present + + The key of the element to add + The value of the element to add + True if the element was added, false otherwise + + + + Tries to add the key/value pair to the if the key is not yet present + + The pair to add + True if the element was added, false otherwise + + + + Tries to find the longest prefix of text, that is contained in this + + The text in which to search for the prefix + The found prefix and the corresponding value + True if a match was found, false otherwise + + + + Tries to find a prefix of text, that is contained in this and is exactly text.Length characters long + + The text in which to search for the prefix + The found prefix and the corresponding value + True if a match was found, false otherwise + + + + Tries to find the shortest prefix of text, that is contained in this + + The text in which to search for the prefix + The found prefix and the corresponding value + True if a match was found, false otherwise + + + + Determines whether the contains the specified key + + The key to locate in this + True if the key is contained in this PrefixTree, false otherwise. + + + + Gets the value associated with the specified key + + The key of the value to get + The value associated with the specified key + True if the key is contained in this PrefixTree, false otherwise. + + + + Gets a collection containing the keys in this + + + + + Gets a collection containing the values in this + + + + + Returns an Enumerator that iterates through the . + Use the index accessor instead () + + + + + + Enumerates the elements of a + + + + + Increments the internal index + + True if the index is less than the length of the internal array + + + + Gets the at the current position + + + + + Does nothing + + + + + Resets the internal index to the beginning of the array + + + + + A default object cache that expect the type {T} to provide a parameter less constructor + + The type of item to cache + + + + + Helper class to decode an entity. + + + + + Decodes the given HTML entity to the matching Unicode characters. + + The entity without & and ; symbols, for example, copy. + The unicode character set or null if the entity was not recognized. + + + + Decodes the given UTF-32 character code to the matching set of UTF-16 characters. + + The unicode character set or null if the entity was not recognized. + + + + Source: http://www.w3.org/html/wg/drafts/html/master/syntax.html#named-character-references + + + + + Helper to parse several HTML tags. + + + + + Destructively unescape a string: remove backslashes before punctuation or symbol characters. + + The string data that will be changed by unescaping any punctuation or symbol characters. + if set to true [remove back slash]. + + + + + Scans an entity. + Returns number of chars matched. + + + + + Provides a common interface for iterating characters + over a or . + + + + + Gets the current start character position. + + + + + Gets the current character. + + + + + Gets the end character position. + + + + + Goes to the next character, incrementing the position. + + The next character. `\0` is end of the iteration. + + + + Goes to the next character, incrementing the position. + + + + + Peeks at the next character, without incrementing the position. + + The next character. `\0` is end of the iteration. + + + + Peeks at the next character, without incrementing the position. + + + The next character. `\0` is end of the iteration. + + + + Gets a value indicating whether this instance is empty. + + + + + Trims whitespaces at the beginning of this slice starting from position. + + true if it has reaches the end of the iterator + + + + A line reader from a that can provide precise source position + + + + + Initializes a new instance of the class. + + + bufferSize cannot be <= 0 + + + + Gets the char position of the line. Valid for the next line before calling . + + + + + Reads a new line from the underlying and update the for the next line. + + A new line or null if the end of has been reached + + + + Helpers to parse Markdown links. + + + + + Represents a character or set of characters that represent a separation + between two lines of text + + + + + A simple object recycling system. + + Type of the object to cache + + + + Initializes a new instance of the class. + + + + + Clears this cache. + + + + + Gets a new instance. + + + + + + Releases the specified instance. + + The instance. + if instance is null + + + + Creates a new instance of {T} + + A new instance of {T} + + + + Resets the specified instance when is called before storing back to this cache. + + The instance. + + + + A List that provides methods for inserting/finding before/after. See remarks. + + Type of the list item + + We use a typed list and don't use extension methods because it would pollute all list implements and the top level namespace. + + + + Replaces with . + + Item type to find in the list + Object to replace this item with + true if a replacement was made; otherwise false. + + + + Replaces with or adds . + + Item type to find in the list + Object to add/replace the found item with + true if a replacement was made; otherwise false. + + + + Removes the first occurrence of + + + + + A StringBuilder that can be used locally in a method body only. + + + + + Provides a string builder that can only be used locally in a method. This StringBuilder MUST not be stored. + + + + + + Extensions for StringBuilder + + + + + Appends the specified slice to this instance. + + The builder. + The slice. + + + + A struct representing a text line. + + + + + Initializes a new instance of the struct. + + The slice. + + + + Initializes a new instance of the struct. + + The slice. + The line. + The column. + The position. + The line separation. + + + + Initializes a new instance of the struct. + + The slice. + The line. + The column. + The position. + The line separation. + + + + The slice used for this line. + + + + + The line position. + + + + + The position of the start of this line within the original source code + + + + + The column position. + + + + + The newline. + + + + + Performs an implicit conversion from to . + + The line. + + The result of the conversion. + + + + + A group of . + + + + + + Initializes a new instance of the class. + + + + + + Initializes a new instance of the class. + + The text. + + + + + Gets the lines. + + + + + Gets the number of lines. + + + + + Clears this instance. + + + + + Removes the line at the specified index. + + The index. + + + + Adds the specified line to this instance. + + The line. + + + + Adds the specified slice to this instance. + + The slice. + + + + Converts the lines to a single by concatenating the lines. + + The position of the `\n` line offsets from the beginning of the returned slice. + A single slice concatenating the lines of this instance + + + + Converts this instance into a . + + + + + + Trims each lines of the specified . + + + + + The iterator used to iterate other the lines. + + + + + + A lightweight struct that represents a slice of a string. + + + + + + An empty string slice. + + + + + Initializes a new instance of the struct. + + The text. + + + + Initializes a new instance of the struct. + + The text. + The line separation. + + + + Initializes a new instance of the struct. + + The text. + The start. + The end. + + + + + Initializes a new instance of the struct. + + The text. + The start. + The end. + The line separation. + + + + + The text of this slice. + + + + + Gets or sets the start position within . + + + + + Gets or sets the end position (inclusive) within . + + + + + Gets the length. + + + + + Gets the current character. + + + + + Gets a value indicating whether this instance is empty. + + + + + Gets the at the specified index. + + The index. + A character in the slice at the specified index (not from but from the begining of the slice) + + + + Goes to the next character, incrementing the position. + + + The next character. `\0` is end of the iteration. + + + + + Goes to the next character, incrementing the position. + + + + + Peeks a character at the offset of 1 from the current position + inside the range and , returns `\0` if outside this range. + + The character at offset, returns `\0` if none. + + + + Peeks a character at the specified offset from the current position + inside the range and , returns `\0` if outside this range. + + The offset. + The character at offset, returns `\0` if none. + + + + Peeks a character at the specified offset from the current beginning of the string, without taking into account and + + The character at offset, returns `\0` if none. + + + + Peeks a character at the specified offset from the current begining of the slice + without using the range or , returns `\0` if outside the . + + The offset. + The character at offset, returns `\0` if none. + + + + Matches the specified text. + + The text. + The offset. + true if the text matches; false otherwise + + + + Matches the specified text. + + The text. + The end. + The offset. + true if the text matches; false otherwise + + + + Expect spaces until a end of line. Return false otherwise. + + true if whitespaces where matched until a end of line + + + + Matches the specified text using lowercase comparison. + + The text. + The offset. + true if the text matches; false otherwise + + + + Matches the specified text using lowercase comparison. + + The text. + The end. + The offset. + true if the text matches; false otherwise + + + + Searches the specified text within this slice. + + The text. + The offset. + true if ignore case + true if the text was found; false otherwise + + + + Searches for the specified character within this slice. + + A value >= 0 if the character was found, otherwise < 0 + + + + Trims whitespaces at the beginning of this slice starting from position. + + + true if it has reaches the end of the iterator + + + + + Trims whitespaces at the beginning of this slice starting from position. + + The number of spaces trimmed. + + + + Trims whitespaces at the end of this slice, starting from position. + + + + + + Trims whitespaces from both the start and end of this slice. + + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Determines whether this slice is empty or made only of whitespaces. + + true if this slice is empty or made only of whitespaces; false otherwise + + + + Inspired by CoreLib, taken from https://github.com/MihaZupan/SharpCollections, cc @MihaZupan + + + + + Resize the internal buffer either by doubling current buffer size or + by adding to + whichever is greater. + + + Number of chars requested beyond current position. + + + + + Base interface for an extension. + + + + + Setups this extension for the specified pipeline. + + The pipeline. + + + + Setups this extension for the specified renderer. + + The pipeline used to parse the document. + The renderer. + + + + Provides methods for parsing a Markdown string to a syntax tree and converting it to other formats. + + + + + Normalizes the specified markdown to a normalized markdown text. + + The markdown. + The normalize options + The pipeline. + A parser context used for the parsing. + A normalized markdown text. + + + + Normalizes the specified markdown to a normalized markdown text. + + The markdown. + The destination that will receive the result of the conversion. + The normalize options + The pipeline. + A parser context used for the parsing. + A normalized markdown text. + + + + Converts a Markdown string to HTML. + + A Markdown text. + The pipeline used for the conversion. + A parser context used for the parsing. + The result of the conversion + if markdown variable is null + + + + Converts a Markdown document to HTML. + + A Markdown document. + The pipeline used for the conversion. + The result of the conversion + if markdown document variable is null + + + + Converts a Markdown document to HTML. + + A Markdown document. + The destination that will receive the result of the conversion. + The pipeline used for the conversion. + The result of the conversion + if markdown document variable is null + + + + Converts a Markdown string to HTML and output to the specified writer. + + A Markdown text. + The destination that will receive the result of the conversion. + The pipeline used for the conversion. + A parser context used for the parsing. + The Markdown document that has been parsed + if reader or writer variable are null + + + + Converts a Markdown string using a custom . + + A Markdown text. + The renderer to convert Markdown to. + The pipeline used for the conversion. + A parser context used for the parsing. + if markdown or writer variable are null + + + + Parses the specified markdown into an AST + + The markdown text. + Whether to parse trivia such as whitespace, extra heading characters and unescaped string values. + An AST Markdown document + if markdown variable is null + + + + Parses the specified markdown into an AST + + The markdown text. + The pipeline used for the parsing. + A parser context used for the parsing. + An AST Markdown document + if markdown variable is null + + + + Converts a Markdown string to Plain text and output to the specified writer. + + A Markdown text. + The destination that will receive the result of the conversion. + The pipeline used for the conversion. + A parser context used for the parsing. + The Markdown document that has been parsed + if reader or writer variable are null + + + + Converts a Markdown string to Plain text by using a . + + A Markdown text. + The pipeline used for the conversion. + A parser context used for the parsing. + The result of the conversion + if markdown variable is null + + + + Provides extension methods for to enable several Markdown extensions. + + + + + Adds the specified extension to the extensions collection. + + The type of the extension. + The instance of + + + + Adds the specified extension instance to the extensions collection. + + The pipeline. + The instance of the extension to be added. + The type of the extension. + The modified pipeline + + + + Uses all extensions except the BootStrap, Emoji, SmartyPants and soft line as hard line breaks extensions. + + The pipeline. + The modified pipeline + + + + Uses this extension to enable alert blocks. + + The pipeline. + Replace the default renderer for the kind with a custom renderer + The modified pipeline + + + + Uses this extension to enable autolinks from text `http://`, `https://`, `ftp://`, `mailto:`, `www.xxx.yyy` + + The pipeline. + The options. + The modified pipeline + + + + Uses this extension to disable URI escape with % characters for non-US-ASCII characters in order to workaround a bug under IE/Edge with local file links containing non US-ASCII chars. DO NOT USE OTHERWISE. + + The pipeline. + The modified pipeline + + + + Uses YAML frontmatter extension that will parse a YAML frontmatter into the MarkdownDocument. Note that they are not rendered by any default HTML renderer. + + The pipeline. + The modified pipeline + + + + Uses the self pipeline extension that will detect the pipeline to use from the markdown input that contains a special tag. See + + The pipeline. + The default tag to use to match the self pipeline configuration. By default, , meaning that the HTML tag will be <--markdig:extensions--> + The default extensions to configure if no pipeline setup was found from the Markdown document + The modified pipeline + + + + Uses pragma lines to output span with an id containing the line number (pragma-line#line_number_zero_based`) + + The pipeline. + The modified pipeline + + + + Uses the diagrams extension + + The pipeline. + The modified pipeline + + + + Uses precise source code location (useful for syntax highlighting). + + The pipeline. + The modified pipeline + + + + Uses the task list extension. + + The pipeline. + The modified pipeline + + + + Uses the custom container extension. + + The pipeline. + The modified pipeline + + + + Uses the media extension. + + The pipeline. + The options. + + The modified pipeline + + + + + Uses the auto-identifier extension. + + The pipeline. + The options. + + The modified pipeline + + + + + Uses the SmartyPants extension. + + The pipeline. + The options. + + The modified pipeline + + + + + Uses the bootstrap extension. + + The pipeline. + The modified pipeline + + + + Uses the math extension. + + The pipeline. + The modified pipeline + + + + Uses the figure extension. + + The pipeline. + The modified pipeline + + + + Uses the custom abbreviation extension. + + The pipeline. + The modified pipeline + + + + Uses the definition lists extension. + + The pipeline. + The modified pipeline + + + + Uses the pipe table extension. + + The pipeline. + The options. + + The modified pipeline + + + + + Uses the grid table extension. + + The pipeline. + The modified pipeline + + + + Uses the cite extension. + + The pipeline. + The modified pipeline + + + + Uses the footer extension. + + The pipeline. + The modified pipeline + + + + Uses the footnotes extension. + + The pipeline. + The modified pipeline + + + + Uses the softline break as hardline break extension + + The pipeline. + The modified pipeline + + + + Uses the strikethrough superscript, subscript, inserted and marked text extensions. + + The pipeline. + The options to enable. + + The modified pipeline + + + + + Uses the list extra extension to add support for `a.`, `A.`, `i.` and `I.` ordered list items. + + The pipeline. + + The modified pipeline + + + + + Uses the generic attributes extension. + + The pipeline. + The modified pipeline + + + + Uses the emojis and smileys extension. + + The pipeline. + Enable smileys in addition to emoji shortcodes, true by default. + The modified pipeline + + + + Uses the emojis and smileys extension. + + The pipeline. + Enable customization of the emojis and smileys mapping. + The modified pipeline + + + + Add rel=nofollow to all links rendered to HTML. + + + + + + + Automatically link references to JIRA issues + + The pipeline + Set of required options + The modified pipeline + + + + Adds support for right-to-left content by adding appropriate html attribtues. + + The pipeline + The modified pipeline + + + + This will disable the HTML support in the markdown processor (for constraint/safe parsing). + + The pipeline. + The modified pipeline + + + + Configures the pipeline using a string that defines the extensions to activate. + + The pipeline (e.g: advanced for , pipetables+gridtables for and + The extensions to activate as a string + The modified pipeline + + + + Configures the string to be used for line-endings, when writing. + + The pipeline. + The string to be used for line-endings. + The modified pipeline + + + + Disables parsing of ATX and Setex headings + + The pipeline. + The modified pipeline + + + + Enables parsing and tracking of trivia characters + + The pipeline. + he modified pipeline + + + + Provides a context that can be used as part of parsing Markdown documents. + + + + + Gets or sets the context property collection. + + + + + Initializes a new instance of the class. + + + + + This class is the Markdown pipeline build from a . + An instance of is immutable, thread-safe, and should be reused when parsing multiple inputs. + + + + + Initializes a new instance of the class. + + + + + The read-only list of extensions used to build this pipeline. + + + + + True to parse trivia such as whitespace, extra heading characters and unescaped + string values. + + + + + Allows to setup a . + + The markdown renderer to setup + + + + This class allows to modify the pipeline to parse and render a Markdown document. + + NOTE: A pipeline is not thread-safe. + + + + Initializes a new instance of the class. + + + + + Gets the block parsers. + + + + + Gets the inline parsers. + + + + + Gets the register extensions. + + + + + Gets or sets a value indicating whether to enable precise source location (slower parsing but accurate position for block and inline elements) + + + + + Gets or sets the debug log. + + + + + True to parse trivia such as whitespace, extra heading characters and unescaped + string values. + + + + + Occurs when a document has been processed after the method. + + + + + Builds a pipeline from this instance. Once the pipeline is build, it cannot be modified. + + An extension cannot be null + + + + Delegates called when processing a block + + + + + Base class for a parser of a + + + + + + Determines whether the specified char is an opening character. + + The character. + true if the specified char is an opening character. + + + + Determines whether this instance can interrupt the specified block being processed. + + The parser processor. + The block being processed. + true if this parser can interrupt the specified block being processed. + + + + Tries to match a block opening. + + The parser processor. + The result of the match + + + + Tries to continue matching a block already opened. + + The parser processor. + The block already opened. + The result of the match. By default, don't expect any newline + + + + Called when a block matched by this parser is being closed (to allow final computation on the block). + + The parser processor. + The block being closed. + true to keep the block; false to remove it. True by default. + + + + A List of . + + + + + + Initializes a new instance of the class. + + The parsers. + + + + The block processor. + + + + + Initializes a new instance of the class. + + The document to build blocks into. + The list of parsers. + A parser context used for the parsing. + Whether to parse trivia such as whitespace, extra heading characters and unescaped string values. + + + + + + Gets the new blocks to push. A is required to push new blocks that it creates to this property. + + + + + Gets the list of s configured with this parser state. + + + + + Gets the parser context or null if none is available. + + + + + Gets the current active container. + + + + + Gets the last block that is opened. + + + + + Gets the last block that is created. + + + + + Gets the next block in a . + + + + + Gets the root document. + + + + + The current line being processed. + + + + + Gets or sets the current line start position. + + + + + Gets the index of the line in the source text. + + + + + Gets a value indicating whether the line is blank (valid only after has been called). + + + + + Gets the current character being processed. + + + + + Gets or sets the column. + + + + + Gets the position of the current character in the line being processed. + + + + + Gets the current indent position (number of columns between the previous indent and the current position). + + + + + Gets a value indicating whether a code indentation is at the beginning of the line being processed. + + + + + Gets the column position before the indent occurred. + + + + + Gets the character position before the indent occurred. + + + + + Gets a boolean indicating whether the current line being parsed is lazy continuation. + + + + + Gets the current stack of being processed. + + + + + Gets or sets the position of the first character trivia is encountered + and not yet assigned to a syntax node. + Trivia: only used when is enabled, otherwise 0. + + + + + Returns trivia that has not yet been assigned to any node and + advances the position of trivia to the ending position. + + End position of the trivia + + + + + Returns the current stack of to assign it to a . + Afterwards, the is set to null. + + + + + Gets or sets the stack of empty lines not yet assigned to any . + An entry may contain an empty . In that case the + is relevant. Otherwise, the + entry will contain trivia. + + + + + True to parse trivia such as whitespace, extra heading characters and unescaped + string values. + + + + + Get the current Container that is currently opened + + The current Container that is currently opened + + + + Returns the next character in the line being processed. Update and . + + The next character or `\0` if end of line is reached + + + + Returns the next character in the line taking into space taken by tabs. Update and . + + + + + Peeks a character at the specified offset from the current position in the line. + + The offset. + A character peeked at the specified offset + + + + Restarts the indent from the current position. + + + + + Parses the indentation from the current position in the line, updating , + , and accordingly + taking into account space taken by tabs. + + + + + Moves to the position to the specified column position, taking into account spaces in tabs. + + The new column position to move the cursor to. + + + + Unwind any previous indent from the current character back to the first space. + + + + + Moves to the position to the code indent ( + 4 spaces). + + The column offset to apply to this indent. + + + + Opens the specified block. + + The block. + + The block must be opened + + + + Force closing the specified block. + + The block. + + + + Discards the specified block from the stack, remove from its parent. + + The block. + + + + Processes a new line. + + The new line. + + + + Closes a block at the specified index. + + The index. + + + + Closes all the blocks opened. + + if set to true [force]. + + + + Mark all blocks in the stack as opened. + + + + + Updates the and . + + Index of a block in a stack considered as the last block to update from. + + + + Tries to continue matching existing opened . + + + A pending parser cannot add a new block when it is not the last pending block + or + The NewBlocks is not empty. This is happening if a LeafBlock is not the last to be pushed + + + + + First phase of the process, try to open new blocks. + + + + + Tries to open new blocks using the specified list of + + The parsers. + true to continue processing the current line + + + + Processes any new blocks that have been pushed to . + + The last result of matching. + if set to true the processing of a new block will close existing opened blocks]. + The NewBlocks is not empty. This is happening if a LeafBlock is not the last to be pushed + + + + Defines the result of parsing a line for a . + + + + + A line is not accepted by this parser. + + + + + The parser is skipped. + + + + + The parser accepts a line and instruct to continue. + + + + + The parser accepts a line, instruct to continue but discard the line (not stored on the block) + + + + + The parser is ending a block, instruct to stop and keep the line being processed. + + + + + The parser is ending a block, instruct to stop and discard the line being processed. + + + + + Extensions used by . + + + + + Determines whether this is discarded. + + State of the block. + true if the block state is in discard state + + + + Determines whether this is in a continue state. + + State of the block. + true if the block state is in continue state + + + + Determines whether this is in a break state. + + State of the block. + true if the block state is in break state + + + + Delegate used to parse the string on the first line after the fenced code block special characters (usually ` or ~) + + The parser processor. + The being processed line. + The fenced code block. + The opening character for the fenced code block (usually ` or ~) + true if parsing of the line is successfull; false otherwise + + + + Gets or sets the information parser. + + + + + A delegates that allows to process attached attributes + + + + + Base parser for fenced blocks (opened by 3 or more character delimiters on a first line, and closed by at least the same number of delimiters) + + + + + + Initializes a new instance of the class. + + + + + Gets or sets the language prefix (default is "language-") + + + + + The roundtrip parser for the information after the fenced code block special characters (usually ` or ~) + + The parser processor. + The line. + The fenced code block. + The opening character for this fenced code block. + true if parsing of the line is successfull; false otherwise + + + + The default parser for the information after the fenced code block special characters (usually ` or ~) + + The parser processor. + The line. + The fenced code block. + The opening character for this fenced code block. + true if parsing of the line is successfull; false otherwise + + + + Parser for a . + + + + + + Initializes a new instance of the class. + + + + + Block parser for a . + + + + + + Initializes a new instance of the class. + + + + + Gets or sets the max count of the leading unescaped # characters + + + + + A delegates that allows to process attached attributes after # + + + + + Block parser for a . + + + + + + Initializes a new instance of the class. + + + + + A delegates that allows to process attached attributes at time. + + The processor. + The slice to look for attached attributes. + The block. + true if attributes were found; otherwise false + + + + An interface used to tag that supports parsing + + + + + A delegates that allows to process attached attributes + + + + + Base interface for a . + + + + + + + Determines whether this instance can interrupt the specified block being processed. + + The parser processor. + The block being processed. + true if this parser can interrupt the specified block being processed. + + + + Tries to match a block opening. + + The parser processor. + The result of the match + + + + Tries to continue matching a block already opened. + + The parser processor. + The block already opened. + The result of the match. By default, don't expect any newline + + + + Called when a block matched by this parser is being closed (to allow final computation on the block). + + The parser processor. + The block being closed. + true to keep the block; false to remove it. True by default. + + + + Base interface for parsing an . + + + + + + + Tries to match the specified slice. + + The parser processor. + The text slice. + true if this parser found a match; false otherwise + + + + Base interface for a block or inline parser. + + The type of processor. + + + + Gets the opening characters this parser will be triggered if the character is found. + + + + + Initializes this parser with the specified parser processor. + + + + + Gets the index of this parser in or . + + + + + Block parser for an indented . + + + + + + Base class for parsing an . + + + + + + Tries to match the specified slice. + + The parser processor. + The text slice. + true if this parser found a match; false otherwise + + + + A list of . + + + + + + Gets the registered post inline processors. + + + + + A delegate called at inline processing stage. + + The processor. + The inline being processed. + + + + The inline parser state used by all . + + + + + Initializes a new instance of the class. + + The document. + The parsers. + A value indicating whether to provide precise source location. + A parser context used for the parsing. + Whether to parse trivia such as whitespace, extra heading characters and unescaped string values. + + + + + + Gets the current block being processed. + + + + + Gets a value indicating whether to provide precise source location. + + + + + Gets or sets the new block to replace the block being processed. + + + + + Gets or sets the current inline. Used by to return a new inline if match was successfull + + + + + Gets the root container of the current . + + + + + Gets the list of inline parsers. + + + + + Gets the parser context or null if none is available. + + + + + Gets the root document. + + + + + Gets or sets the index of the line from the begining of the document being processed. + + + + + Gets the parser states that can be used by using their property. + + + + + Gets or sets the debug log writer. No log if null. + + + + + True to parse trivia such as whitespace, extra heading characters and unescaped + string values. + + + + + Gets the literal inline parser. + + + + + Gets the source position for the specified offset within the current slice. + + The slice offset. + The line index. + The column. + The source position + + + + Gets the source position for the specified offset within the current slice. + + The slice offset. + The source position + + + + Replace a parent container. This method is experimental and should be used with caution. + + The previous parent container to replace + The new parent container + If a new parent container has been already setup. + + + + Processes the inline of the specified . + + The leaf block. + + + + An inline parser for parsing . + + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether to enable HTML parsing. Default is true + + + + + An inline parser for a . + + + + + + Initializes a new instance of the class. + + + + + Descriptor for an emphasis. + + + + + Initializes a new instance of the class. + + The character used for this emphasis. + The minimum number of character. + The maximum number of characters. + if set to true the emphasis can be used inside a word. + + + + The character of this emphasis. + + + + + The minimum number of character this emphasis is expected to have (must be >=1) + + + + + The maximum number of character this emphasis is expected to have (must be >=1 and >= minimumCount) + + + + + This emphasis can be used within a word. + + + + + An inline parser for . + + + + + + + Initializes a new instance of the class. + + + + + Gets the emphasis descriptors. + + + + + Determines whether this parser is using the specified character as an emphasis delimiter. + + The character to look for. + true if this parser is using the specified character as an emphasis delimiter; otherwise false + + + + Gets or sets the create emphasis inline delegate (allowing to create a different emphasis inline class) + + + + + An inline parser for escape characters. + + + + + + An inline parser for HTML entities. + + + + + + Initializes a new instance of the class. + + + + + An inline parser for . + + + + + + Initializes a new instance of the class. + + + + + Gets or sets a value indicating whether to interpret softline breaks as hardline breaks. Default is false + + + + + An inline parser for . + + + + + + Initializes a new instance of the class. + + + + + An inline parser for parsing . + + + + + + We don't expect the LiteralInlineParser to be instantiated a end-user, as it is part + of the default parser pipeline (and should always be the last), working as a literal character + collector. + + + + + Gets or sets the post match delegate called after the inline has been processed. + + + + + A processor called at the end of processing all inlines. + + + + + Processes the delimiters. + + The parser state. + The root inline. + The last child. + Index of this delimiter processor. + + true to continue to the next delimiter processor; + false to stop the process (in case a processor is performing sub-sequent processor itself) + + + + A parser for a list block and list item block. + + + + + + Initializes a new instance of the class. + + + + + Gets the parsers for items. + + + + + Defines list information returned when trying to parse a list item with + + + + + Initializes a new instance of the struct. + + Type of the bullet (e.g: '1', 'a', 'A', 'i', 'I'). + + + + Initializes a new instance of the struct. + + Type of the bullet (e.g: '1', 'a', 'A', 'i', 'I') + The string used as a starting sequence for an ordered list. + The ordered delimiter found when parsing this list (e.g: the character `)` after `1)`) + The default string used as a starting sequence for the ordered list (e.g: '1' for an numbered ordered list) + + + + Gets or sets the type of the bullet (e.g: '1', 'a', 'A', 'i', 'I'). + + + + + Gets or sets the string used as a starting sequence for an ordered list + + + + + Gets or sets the ordered delimiter found when parsing this list (e.g: the character `)` after `1)`) + + + + + Gets or sets default string used as a starting sequence for the ordered list (e.g: '1' for an numbered ordered list) + + + + + A parser base class for a list item. + + + + + Defines the characters that are used for detecting this list item. + + + + + Tries to parse the current input as a list item for this particular instance. + + The block processor + The type of the current bullet type + The result of parsing + true if parsing was successful; false otherwise + + + + Delegates called when processing a document + + The markdown document. + + + + The Markdown parser. + + + + + Parses the specified markdown into an AST + + A Markdown text + The pipeline used for the parsing. + A parser context used for the parsing. + An AST Markdown document + if reader variable is null + + + + Fixups the zero character by replacing it to a secure character (Section 2.3 Insecure characters, CommonMark specs) + + The text to secure. + + + + The default parser for parsing numbered list item (e.g: 1) or 1.) + + + + + + Initializes a new instance of the class. + + + + + Base class for an ordered list item parser. + + + + + + Initializes a new instance of the class. + + + + + Gets or sets the ordered delimiters used after a digit/number (by default `.` and `)`) + + + + + Utility method that tries to parse the delimiter coming after an ordered list start (e.g: the `)` after `1)`). + + The state. + The ordered delimiter found if this method is successful. + true if parsing was successful; false otherwise. + + + + Block parser for a . + + + + + + Base class for a or . + + Type of the parser processor + + + + + Gets the opening characters this parser will be triggered if the character is found. + + + + + Initializes this parser with the specified parser processor. + + + + + Gets the index of this parser in or . + + + + + Base class for a list of parsers. + + Type of the parser + The type of the parser state. + + + + + Gets the list of global parsers (that don't have any opening characters defined) + + + + + Gets all the opening characters defined. + + + + + Gets the list of parsers valid for the specified opening character. + + The opening character. + A list of parsers valid for the specified opening character or null if no parsers registered. + + + + Searches for an opening character from a registered parser in the specified string. + + The text. + The start. + The end. + Index position within the string of the first opening character found in the specified text; if not found, returns -1 + + + + A block parser for a . + + + + + + Initializes a new instance of the class. + + + + + A block parser for a . + + + + + + A singleton instance used by other parsers. + + + + + Initializes a new instance of the class. + + + + + The default parser used to parse unordered list item (-, +, *) + + + + + + Initializes a new instance of the class. + + + + + Default HTML renderer for a Markdown object. + + + + + + Initializes a new instance of the class. + + The writer. + + + + Gets or sets a value indicating whether to output HTML tags when rendering. See remarks. + + + This is used by some renderers to disable HTML tags when rendering some inline elements (for image links). + + + + + Gets or sets a value indicating whether to output HTML tags when rendering. See remarks. + + + This is used by some renderers to disable HTML tags when rendering some block elements (for image links). + + + + + Gets or sets a value indicating whether to use implicit paragraph (optional <p>) + + + + + Gets a value to use as the base url for all relative links + + + + + Allows links to be rewritten + + + + + Writes the content escaped for HTML. + + The content. + This instance + + + + Writes the content escaped for HTML. + + The slice. + Only escape < and & + This instance + + + + Writes the content escaped for HTML. + + The slice. + Only escape < and & + This instance + + + + Writes the content escaped for HTML. + + The content. + The offset. + The length. + Only escape < and & + This instance + + + + Writes the content escaped for HTML. + + The content. + Only escape < and & + + + + Writes the URL escaped for HTML. + + The content. + This instance + + + + Writes the attached on the specified . + + The object. + + + + + Writes the specified . + + The attributes to render. + A class filter used to transform a class into another class at writing time + This instance + + + + Writes the lines of a + + The leaf block. + if set to true write end of lines. + if set to true escape the content for HTML + Only escape < and & + This instance + + + + An HTML renderer for a and . + + + + + + Initializes a new instance of the class. + + + + + Gets a map of fenced code block infos that should be rendered as div blocks instead of pre/code blocks. + + + + + An HTML renderer for a . + + + + + + Attached HTML attributes to a . + + + + + Initializes a new instance of the class. + + + + + Gets or sets the HTML id/identifier. May be null. + + + + + Gets or sets the CSS classes attached. May be null. + + + + + Gets or sets the additional properties. May be null. + + + + + Adds a CSS class. + + The css class name. + + + + Adds a property. + + The name. + The value. + + + + Adds the specified property only if it does not already exist. + + The name. + The value. + + + + Copies/merge the values from this instance to the specified instance. + + The HTML attributes. + If set to true it will merge properties to the target htmlAttributes. Default is false + If set to true it will try to share Classes and Properties if destination don't have them, otherwise it will make a copy. Default is true + + + + + Extensions for a to allow accessing + + + + + Tries the get stored on a . + + The markdown object. + The attached html attributes or null if not found + + + + Gets or creates the stored on a + + The markdown object. + The attached html attributes + + + + Sets to the + + The markdown object. + The attributes to attach. + + + + A HTML renderer for a . + + + + + + A base class for HTML rendering and Markdown objects. + + The type of the object. + + + + + A HTML renderer for an . + + + + + + Gets or sets a value indicating whether to always add rel="nofollow" for links or not. + + + + + Gets or sets the literal string in property rel for links + + + + + A HTML renderer for a . + + + + + + A HTML renderer for a . + + + + + + A HTML renderer for an . + + + + + + Delegates to get the tag associated to an object. + + The object. + The HTML tag associated to this object + + + + Initializes a new instance of the class. + + + + + Gets or sets the GetTag delegate. + + + + + Gets the default HTML tag for ** and __ emphasis. + + The object. + + + + + A HTML renderer for a . + + + + + + A HTML renderer for a . + + + + + + A HTML renderer for a . + + + + + + Gets or sets a value indicating whether to render this softline break as a HTML hardline break tag (<br />) + + + + + A HTML renderer for a . + + + + + + Gets or sets a value indicating whether to always add rel="nofollow" for links or not. + + + + + Gets or sets the literal string in property rel for links + + + + + A HTML renderer for a . + + + + + + A HTML renderer for a . + + + + + + A HTML renderer for a . + + + + + + A HTML renderer for a . + + + + + + A HTML renderer for a . + + + + + + Base interface for the renderer of a . + + + + + Accepts the specified . + + The renderer. + The of the Markdown object. + true If this renderer is accepting to render the specified Markdown object + + + + Writes the specified to the . + + The renderer. + The object to render. + + + + Base interface for a renderer for a Markdown . + + + + + Occurs when before writing an object. + + + + + Occurs when after writing an object. + + + + + Gets the object renderers that will render and elements. + + + + + Renders the specified markdown object. + + The markdown object. + The result of the rendering. + + + + A base class for rendering and Markdown objects. + + The type of the renderer. + The type of the object. + + + + + Gets the optional writers attached to this instance. + + + + + Writes the specified Markdown object to the renderer. + + The renderer. + The markdown object. + + + + An Normalize renderer for a and . + + + + + + An Normalize renderer for a . + + + + + + A Normalize renderer for an . + + + + + + A Normalize renderer for a . + + + + + + A Normalize renderer for a . + + + + + + A Normalize renderer for an . + + + + + + A Normalize renderer for a . + + + + + + Gets or sets a value indicating whether to render this softline break as a Normalize hardline break tag (<br />) + + + + + A Normalize renderer for a . + + + + + + A Normalize renderer for a . + + + + + + A Normalize renderer for a . + + + + + A Normalize renderer for a . + + + + + A Normalize renderer for a . + + + + + + A base class for Normalize rendering and Markdown objects. + + The type of the object. + + + + + Defines the options used by + + + + + Initialize a new instance of + + + + + Adds a space after a QuoteBlock >. Default is true + + + + + Adds an empty line after a code block (fenced and tabbed). Default is true + + + + + Adds an empty line after an heading. Default is true + + + + + Adds an empty line after an thematic break. Default is true + + + + + The bullet character used for list items. Default is null leaving the original bullet character as-is. + + + + + Expands AutoLinks to the normal inline representation. Default is true + + + + + Default HTML renderer for a Markdown object. + + + + + + Initializes a new instance of the class. + + The writer. + The normalize options + + + + Writes the lines of a + + The leaf block. + if set to true write end of lines. + Whether to write indents. + This instance + + + + A Normalize renderer for a . + + + + + + A Normalize renderer for a . + + + + + + A Normalize renderer for a . + + + + + + A collection of . + + + + + + Base class for a . + + + + + + Initializes a new instance of the class. + + + + + Occurs when before writing an object. + + + + + Occurs when after writing an object. + + + + + Writes the children of the specified . + + The container block. + + + + Writes the children of the specified . + + The container inline. + + + + Writes the specified Markdown object. + + The Markdown object to write to this renderer. + + + + An Roundtrip renderer for a and . + + + + + + An Roundtrip renderer for a . + + + + + + A Normalize renderer for an . + + + + + + A Normalize renderer for a . + + + + + + A Normalize renderer for a . + + + + + + A Normalize renderer for an . + + + + + + A Normalize renderer for a . + + + + + + A Normalize renderer for a . + + + + + + A Normalize renderer for a . + + + + + + A Normalize renderer for a . + + + + + A Normalize renderer for a . + + + + + A Roundtrip renderer for a . + + + + + + A Roundtrip renderer for a . + + + + + + A Roundtrip renderer for a . + + + + + A base class for Normalize rendering and Markdown objects. + + The type of the object. + + + + + Markdown renderer honoring trivia for a object. + + Ensure to call the extension method when + parsing markdown to have trivia available for rendering. + + + + Initializes a new instance of the class. + + The writer. + + + + Writes the lines of a + + The leaf block. + This instance + + + + A Roundtrip renderer for a . + + + + + + A text based . + + + + + + Initializes a new instance of the class. + + The writer. + + + + + Gets or sets the writer. + + if the value is null + + + + Renders the specified markdown object (returns the as a render object). + + The markdown object. + + + + + Typed . + + Type of the renderer + + + + + Initializes a new instance of the class. + + The writer. + + + + Ensures a newline. + + This instance + + + + Writes the specified content. + + The content. + This instance + + + + Writes the specified char repeated a specified number of times. + + The char to write. + The number of times to write the char. + This instance + + + + Writes the specified slice. + + The slice. + This instance + + + + Writes the specified slice. + + The slice. + This instance + + + + Writes the specified character. + + The content. + This instance + + + + Writes the specified content. + + The content. + The offset. + The length. + This instance + + + + Writes the specified content. + + The content. + + + + Writes a newline. + + This instance + + + + Writes a newline. + + This instance + + + + Writes a content followed by a newline. + + The content. + This instance + + + + Writes a content followed by a newline. + + The content. + This instance + + + + Writes the inlines of a leaf inline. + + The leaf block. + This instance + + + + A blank line, used internally by some parsers to store blank lines in a container. They are removed before the end of the document. + + + + + + Initializes a new instance of the class. + + + + + Base class for a block structure. Either a or a . + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Gets the parent of this container. May be null. + + + + + Gets the parser associated to this instance. + + + + + Gets or sets a value indicating whether this instance is still open. + + + + + Gets or sets a value indicating whether this block is breakable. Default is true. + + + + + The last newline of this block. + Trivia: only parsed when is enabled + + + + + Gets or sets a value indicating whether this block must be removed from its container after inlines have been processed. + + + + + Gets or sets the trivia right before this block. + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets trivia occurring after this block. + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the empty lines occurring before this block. + Trivia: only parsed when is enabled, otherwise null. + + + + + Gets or sets the empty lines occurring after this block. + Trivia: only parsed when is enabled, otherwise null. + + + + + Occurs when the process of inlines begin. + + + + + Occurs when the process of inlines ends for this instance. + + + + + Called when the process of inlines begin. + + The inline parser state. + + + + Called when the process of inlines ends. + + The inline parser state. + + + + Extensions for + + + + + Helpers for the class. + + + + + Represents an indented code block. + + + Related to CommonMark spec: 4.4 Indented code blocks + + + + + Initializes a new instance of the class. + + The parser. + + + + A base class for container blocks. + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Gets the last child. + + + + + Specialize enumerator. + + + + + + Represents a fenced code block. + + + Related to CommonMark spec: 4.5 Fenced code blocks + + + + + Initializes a new instance of the class. + + The parser. + + + + Gets or sets the indent count when the fenced code block was indented + and we need to remove up to indent count chars spaces from the beginning of a line. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents a heading. + + + + + Initializes a new instance of the class. + + The parser. + + + + Gets or sets the header character used to defines this heading (usually #) + + + + + Gets or sets the level of heading (starting at 1 for the lowest level). + + + + + True if this heading is a Setext heading. + + + + + Gets or sets the amount of - or = characters when is true. + + + + + Gets or sets the newline of the first line when is true. + Trivia: only parsed when is enabled. + + + + + Gets or sets the whitespace after the # character when is false. + Trivia: only parsed when is enabled, otherwise + . + + + + + Represents a group of lines that is treated as raw HTML (and will not be escaped in HTML output). + + + + + + Initializes a new instance of the class. + + The parser. + + + + Gets or sets the type of block. + + + + + Defines the type of + + + + + A SGML document type starting by <!LETTER. + + + + + A raw CDATA sequence. + + + + + A HTML comment. + + + + + A SGM processing instruction tag <? + + + + + A script pre or style tag. + + + + + An HTML interrupting block + + + + + An HTML non-interrupting block + + + + + Base interface for a block structure. Either a or a . + + + + + + Gets or sets the text column this instance was declared (zero-based). + + + + + Gets or sets the text line this instance was declared (zero-based). + + + + + Gets the parent of this container. May be null. + + + + + Gets the parser associated to this instance. + + + + + Gets or sets a value indicating whether this instance is still open. + + + + + Gets or sets a value indicating whether this block is breakable. Default is true. + + + + + Gets or sets a value indicating whether this block must be removed from its container after inlines have been processed. + + + + + Occurs when the process of inlines begin. + + + + + Occurs when the process of inlines ends for this instance. + + + + + Trivia occurring before this block + + Trivia: only parsed when is enabled, otherwise . + + + + Trivia occurring after this block + + Trivia: only parsed when is enabled, otherwise . + + + + A common interface for fenced block (e.g: or ) + + + + + Gets or sets the fenced character used to open and close this fenced code block. + + + + + Gets or sets the fenced character count used to open this fenced code block. + + + + + Gets or sets the trivia after the . + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the language parsed after the first line of + the fenced code block. May be null. + + + + + Non-escaped exactly as in source markdown. + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the trivia after the . + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the arguments after the . + May be null. + + + + + Non-escaped exactly as in source markdown. + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the trivia after the . + Trivia: only parsed when is enabled, otherwise + . + + + + + Newline of the line with the opening fenced chars. + Trivia: only parsed when is enabled, otherwise + . + + + + + Trivia before the closing fenced chars + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the fenced character count used to close this fenced code block. + + + + + Newline after the last line, which is always the line containing the closing fence chars. + "Inherited" from . + Trivia: only parsed when is enabled, otherwise + . + + + + + Base interface for a the Markdown syntax tree + + + + + Stores a key/value pair for this instance. + + The key. + The value. + if key is null + + + + Determines whether this instance contains the specified key data. + + The key. + true if a data with the key is stored + if key is null + + + + Gets the associated data for the specified key. + + The key. + The associated data or null if none + if key is null + + + + Removes the associated data for the specified key. + + The key. + true if the data was removed; false otherwise + + + + + An autolink (Section 6.7 CommonMark specs) + + + + + + Gets or sets a value indicating whether this instance is an email link. + + + + + Gets or sets the URL of this link. + + + + + Represents a code span (Section 6.3 CommonMark specs) + + + + + + Gets or sets the delimiter character used by this code inline. + + + + + Gets or sets the amount of delimiter characters used + + + + + Gets or sets the content of the span. + + + + + Gets or sets the content with trivia and whitespace. + Trivia: only parsed when is enabled, otherwise + . + + + + + A base class for container for . + + + + + + Gets the parent block of this inline. + + + + + Gets the first child. + + + + + Gets the last child. + + + + + Clears this instance by removing all its children. + + + + + Appends a child to this container. + + The child to append to this container.. + This instance + If child is null + Inline has already a parent + + + + Checks if this instance contains the specified child. + + The child to find. + true if this instance contains the specified child; false otherwise + + + + Finds all the descendants. + + Type of the descendants to find + An enumeration of T + + + + Moves all the children of this container after the specified inline. + + The parent. + + + + Embraces this instance by the specified container. + + The container to use to embrace this instance. + If the container is null + + + + Internal delimiter used by some parsers (e.g emphasis, tables). + + + + + + Gets the parser. + + + + + Gets or sets the type of this delimiter. + + + + + Gets or sets a value indicating whether this instance is active. + + + + + Converts this delimiter to a literal. + + The string representation of this delimiter + + + + Gets the type of a . + + + + + An undefined open or close delimiter. + + + + + An open delimiter. + + + + + A close delimiter. + + + + + A delimiter used for parsing emphasis. + + + + + + Initializes a new instance of the class. + + The parser. + The descriptor. + + + + + Initializes a new instance of the class. + + The parser. + The descriptor. + The content. + + + + + Gets the descriptor for this emphasis. + + + + + The delimiter character found. + + + + + The number of delimiter characters found for this delimiter. + + + + + The content as a . + + + + + An emphasis and strong emphasis (Section 6.4 CommonMark specs). + + + + + + Gets or sets the delimiter character of this emphasis. + + + + + Gets or sets a value indicating whether this is strong. + Marked obsolete as EmphasisInline can now be represented by more than two delimiter characters + + + + + Gets or sets the number of delimiter characters for this emphasis. + + + + + An entity HTML. + + + + + + Gets or sets the original HTML entity name + + + + + Gets or sets the transcoded literal that will be used for output + + + + + A Raw HTML (Section 6.8 CommonMark specs). + + + + + + Gets or sets the full declaration of this tag. + + + + + Base interface for all syntax tree inlines. + + + + + + Gets the parent container of this inline. + + + + + Gets the previous inline. + + + + + Gets the next sibling inline. + + + + + Gets or sets a value indicating whether this instance is closed. + + + + + Base class for all syntax tree inlines. + + + + + + Gets the parent container of this inline. + + + + + Gets the previous inline. + + + + + Gets the next sibling inline. + + + + + Gets or sets a value indicating whether this instance is closed. + + + + + Inserts the specified inline after this instance. + + The inline to insert after this instance. + + Inline has already a parent + + + + Inserts the specified inline before this instance. + + The inline previous to insert before this instance. + + Inline has already a parent + + + + Removes this instance from the current list and its parent + + + + + Replaces this inline by the specified inline. + + The inline. + if set to true the children of this instance are copied to the specified inline. + The last children + If inline is null + + + + Determines whether this instance contains a parent of the specified type. + + Type of the parent to check + true if this instance contains a parent of the specified type; false otherwise + + + + Iterates on parents of the specified type. + + Type of the parent to iterate over + An enumeration on the parents of the specified type + + + + Dumps this instance to . + + The writer. + + + + + Dumps this instance to . + + The writer. + The level of indent. + if writer is null + + + + A base class for a leaf inline. + + + + + + A base class for a line break. + + + + + + A delimiter for a link. + + + + + + Gets or sets a value indicating whether this delimiter is an image link. + + + + + Gets or sets the label of this link. + + + + + The label span + + + + + Gets or sets the with trivia. + Trivia: only parsed when is enabled, otherwise + . + + + + + A Link inline (Section 6.5 CommonMark specs) + + + + + + A delegate to use if it is setup on this instance to allow late binding + of a Url. + + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The URL. + The title. + + + + Gets or sets a value indicating whether this instance is an image link. + + + + + Gets or sets the label. + + + + + The label span + + + + + Gets or sets the with trivia. + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the type of label parsed + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the reference this link is attached to. May be null. + + + + + Gets or sets the label as matched against the . + Trivia: only parsed when is enabled. + + + + + Gets or sets the with trivia as matched against + the + + + + + Gets or sets the trivia before the . + Trivia: only parsed when is enabled, otherwise + . + + + + + True if the in the source document is enclosed + in pointy brackets. + Trivia: only parsed when is enabled, otherwise + false. + + + + + Gets or sets the URL. + + + + + The URL source span. + + + + + The but with trivia and unescaped characters + Trivia: only parsed when is enabled, otherwise + . + + + + + Any trivia after the . + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the GetDynamicUrl delegate. If this property is set, + it is used instead of to get the Url from this instance. + + + + + Gets or sets the character used to enclose the . + Trivia: only parsed when is enabled. + + + + + Gets or sets the title. + + + + + The title source span. + + + + + Gets or sets the exactly as parsed from the + source document including unescaped characters + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the trivia after the . + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets a boolean indicating if this link is a shortcut link to a + + + + + Gets or sets a boolean indicating whether the inline link was parsed using markdown syntax or was automatic recognized. + + + + + A literal inline. + + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The content. + + + + Initializes a new instance of the class. + + The text. + + + + + The content as a . + + + + + A boolean indicating whether the first character of this literal is escaped by `\`. + + + + + Base class for all leaf blocks. + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Gets or sets the string lines accumulated for this leaf block. + May be null after process inlines have occurred. + + + + + Gets or sets the inline syntax tree (may be null). + + + + + Gets or sets a value indicating whether must be processed + as inline into the property. + + + + + Appends the specified line to this instance. + + The slice. + The column. + The line. + + Whether to keep track of trivia such as whitespace, extra heading characters and unescaped string values. + + + + A link reference definition (Section 4.7 CommonMark specs) + + + + + + Creates an inline link for the specified . + + State of the inline. + The link reference. + The child. + An inline link or null to use the default implementation + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The label. + The URL. + The title. + + + + Gets or sets the label. Text is normalized according to spec. + + https://spec.commonmark.org/0.29/#matches + + + + The label span + + + + + Non-normalized Label (includes trivia) + Trivia: only parsed when is enabled, otherwise + . + + + + + Whitespace before the . + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the URL. + + + + + The URL span + + + + + Non-normalized . + Trivia: only parsed when is enabled, otherwise + . + + + + + True when the is enclosed in point brackets in the source document. + Trivia: only parsed when is enabled, otherwise + false. + + + + + gets or sets the whitespace before a . + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the title. + + + + + The title span + + + + + Non-normalized . + Trivia: only parsed when is enabled, otherwise + . + + + + + Gets or sets the character the is enclosed in. + Trivia: only parsed when is enabled, otherwise \0. + + + + + Gets or sets the create link inline callback for this instance. + + + This callback is called when an inline link is matching this reference definition. + + + + + Tries to the parse the specified text into a definition. + + Type of the text + The text. + The block. + true if parsing is successful; false otherwise + + + + Tries to the parse the specified text into a definition. + + Type of the text + The text. + The block. + + + + + + + + true if parsing is successful; false otherwise + + + + Extension methods for accessing attached at the document level. + + + + + Contains all the found in a document. + + + + + + Initializes a new instance of the class. + + + + + Gets an association between a label and the corresponding + + + + + A list (Section 5.3 CommonMark specs) + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Gets or sets a value indicating whether the list is ordered. + + + + + Gets or sets the bullet character used by this list. + + + + + Gets or sets the ordered start number (valid when is true) + + + + + Gets or sets the default ordered start ("1" for BulletType = '1') + + + + + Gets or sets the ordered delimiter character (usually `.` or `)`) found after an ordered list item. + + + + + Gets or sets a value indicating whether this instance is loose. + + + + + A list item (Section 5.2 CommonMark specs) + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + The number defined for this in an ordered list + + + + + Gets or sets the bullet as parsed in the source document. + Trivia: only parsed when is enabled, otherwise + . + + + + + The root Markdown document. + + + + + + Initializes a new instance of the class. + + + + + Gets the number of lines in this + + + + + Gets a list of zero-based indexes of line beginnings in the source span + Available if is used, otherwise null + + + + + Base implementation for a the Markdown syntax tree. + + + + + The attached datas. Use internally a simple array instead of a Dictionary{Object,Object} + as we expect less than 5~10 entries, usually typically 1 (HtmlAttributes) + so it will gives faster access than a Dictionary, and lower memory occupation + + + + + Gets or sets the text column this instance was declared (zero-based). + + + + + Gets or sets the text line this instance was declared (zero-based). + + + + + The source span + + + + + Gets a string of the location in the text. + + + + + + Stores a key/value pair for this instance. + + The key. + The value. + if key is null + + + + Determines whether this instance contains the specified key data. + + The key. + true if a data with the key is stored + if key is null + + + + Gets the associated data for the specified key. + + The key. + The associated data or null if none + if key is null + + + + Removes the associated data for the specified key. + + The key. + true if the data was removed; false otherwise + + + + + Extensions for visiting or + + + + + Iterates over the descendant elements for the specified markdown element, including and . + The descendant elements are returned in DFS-like order. + + The markdown object. + An iteration over the descendant elements + + + + Iterates over the descendant elements for the specified markdown element, including and and filters by the type . + The descendant elements are returned in DFS-like order. + + Type to use for filtering the descendants + The markdown object. + An iteration over the descendant elements + + + + Iterates over the descendant elements for the specified markdown element and filters by the type . + + Type to use for filtering the descendants + The inline markdown object. + + An iteration over the descendant elements + + + + + Iterates over the descendant elements for the specified markdown element and filters by the type . + + Type to use for filtering the descendants + The markdown object. + + An iteration over the descendant elements + + + + + Block representing a document with characters but no blocks. This can + happen when an input document consists solely of trivia. + + + + + Represents a paragraph. + + + Related to CommonMark spec: 4.8 Paragraphs + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + A block quote (Section 5.1 CommonMark specs) + + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + + Gets or sets the trivia per line of this QuoteBlock. + Trivia: only parsed when is enabled, otherwise null. + + + + + Gets or sets the quote character (usually `>`) + + + + + Represents trivia per line part of a QuoteBlock. + Trivia: only parsed when is enabled. + + + + + Gets or sets trivia occurring before the first quote character. + + + + + True when this QuoteBlock line has a quote character. False when + this line is a "lazy line". + + + + + True if a space is parsed right after the quote character. + + + + + Gets or sets the trivia after the the space after the quote character. + The first space is assigned to , subsequent + trivia is assigned to this property. + + + + + Gets or sets the newline of this QuoeBlockLine. + + + + + A span of text. + + + + + Initializes a new instance of the struct. + + The start. + The end. + + + + Gets or sets the starting character position from the original text source. + Note that for inline elements, this is only valid if is setup on the pipeline. + + + + + Gets or sets the ending character position from the original text source. + Note that for inline elements, this is only valid if is setup on the pipeline. + + + + + Gets the character length of this element within the original source code. + + + + + Represents a thematic break (Section 4.1 CommonMark specs). + + + + + Initializes a new instance of the class. + + The parser used to create this block. + + + diff --git a/Codist/Lib/System.Buffers.dll b/Codist/Lib/System.Buffers.dll new file mode 100644 index 00000000..14e5c532 Binary files /dev/null and b/Codist/Lib/System.Buffers.dll differ diff --git a/Codist/Lib/System.Memory.dll b/Codist/Lib/System.Memory.dll new file mode 100644 index 00000000..31486d69 Binary files /dev/null and b/Codist/Lib/System.Memory.dll differ diff --git a/Codist/Lib/System.Runtime.CompilerServices.Unsafe.dll b/Codist/Lib/System.Runtime.CompilerServices.Unsafe.dll new file mode 100644 index 00000000..b50dbc4d Binary files /dev/null and b/Codist/Lib/System.Runtime.CompilerServices.Unsafe.dll differ