internal void FormatParagraph(StringBuilder dest, string str, int start, int len)
{
// Parse the string into a list of tokens
Tokenize(str, start, len);
// If the image is a titled image and there's a class defined for titled images, we'll render it using special markup, otherwise we'll render
// the image as-is.
if (m_Tokens.Count == 1 && !string.IsNullOrWhiteSpace(m_Markdown.HtmlClassTitledImages) && m_Tokens[0].type == TokenType.img &&
m_Tokens[0].data is LinkInfo && !string.IsNullOrWhiteSpace(((LinkInfo)m_Tokens[0].data).Definition.Title))
{
// Grab the link info
LinkInfo li = (LinkInfo)m_Tokens[0].data;
// Render the div opening
dest.Append("<div class=\"");
dest.Append(m_Markdown.HtmlClassTitledImages);
dest.Append("\">\n");
// Render the img
m_Markdown.RenderingTitledImage = true;
Render(dest, str);
m_Markdown.RenderingTitledImage = false;
dest.Append("\n");
// Render the title
if (!String.IsNullOrEmpty(li.Definition.Title))
{
dest.Append("<p>");
Utils.SmartHtmlEncodeAmpsAndAngles(dest, li.Definition.Title);
dest.Append("</p>\n");
}
dest.Append("</div>\n");
}
else
{
// Render the paragraph
dest.Append("<p>");
Render(dest, str);
dest.Append("</p>\n");
}
}