MarkdownDeep.Markdown.GetLinkDefinition C# (CSharp) Method

GetLinkDefinition() public method

public GetLinkDefinition ( string id ) : LinkDefinition
id string
return LinkDefinition
        public LinkDefinition GetLinkDefinition(string id)
        {
            LinkDefinition link;
            if (m_LinkDefinitions.TryGetValue(id, out link))
                return link;
            else
                return null;
        }

Usage Example

Example #1
0
        public static string FormatCodePrettyPrint(Markdown m, string code)
        {
            var match = rxExtractLanguage.Match(code);
            string language = null;

            if (match.Success)
            {
                // Save the language
                var g=(Group)match.Groups[2];
                language = g.ToString();

                // Remove the first line
                code = code.Substring(match.Groups[1].Length);
            }

            if (language == null)
            {
                var d = m.GetLinkDefinition("default_syntax");
                if (d!=null)
                    language = d.title;
            }
            if (language == "C#")
                language = "csharp";
            if (language == "C++")
                language = "cpp";

            if (string.IsNullOrEmpty(language))
                return string.Format("<pre><code>{0}</code></pre>\n", code);
            else
                return string.Format("<pre class=\"prettyprint lang-{0}\"><code>{1}</code></pre>\n", language.ToLowerInvariant(), code);
        }
All Usage Examples Of MarkdownDeep.Markdown::GetLinkDefinition