Example #1
0
        /// <summary>
        /// Transforms a block of text with Markdown. The input will be sanitized. The result will be cached.
        /// </summary>
        /// <param name="markdownText">Markdown text to be transformed. HTML will be encoded.</param>
        /// <returns>Markdown-transformed text. This will include HTML.</returns>
        public string GetHtml(string markdownText)
        {
            if (string.IsNullOrEmpty(markdownText))
            {
                return(markdownText);
            }

            var key = string.Format("MarkdownParser.Html_{0}", markdownText);

            return(cache.GetOrInsert(key, CachePolicy.Never(), () => TranformMarkdown(markdownText)));
        }