HGMarkdownHighlighter: use font family of inline code for MathJax

This commit is contained in:
Le Tan 2018-06-30 22:16:33 +08:00
parent 2123e3abff
commit 15151742c9

View File

@ -49,13 +49,26 @@ HGMarkdownHighlighter::HGMarkdownHighlighter(const QVector<HighlightingStyle> &s
m_codeBlockFormat.setForeground(QBrush(Qt::darkYellow)); m_codeBlockFormat.setForeground(QBrush(Qt::darkYellow));
for (int index = 0; index < styles.size(); ++index) { for (int index = 0; index < styles.size(); ++index) {
const pmh_element_type &eleType = styles[index].type; switch (styles[index].type) {
if (eleType == pmh_VERBATIM) { case pmh_VERBATIM:
m_codeBlockFormat = styles[index].format; m_codeBlockFormat = styles[index].format;
} else if (eleType == pmh_LINK) { break;
case pmh_LINK:
m_linkFormat = styles[index].format; m_linkFormat = styles[index].format;
} else if (eleType == pmh_IMAGE) { break;
case pmh_IMAGE:
m_imageFormat = styles[index].format; m_imageFormat = styles[index].format;
break;
case pmh_CODE:
// Use inline code font family for MathJax format.
m_mathjaxFormat.setFontFamily(styles[index].format.fontFamily());
break;
default:
break;
} }
} }