From 51d0eedcb271efbec378a68cb7eb8d25d8758fa1 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Tue, 25 Oct 2016 10:21:31 +0800 Subject: [PATCH] fix HGMarkdownHighlighter regular expression Change the default markdown.css. Signed-off-by: Le Tan --- src/hgmarkdownhighlighter.cpp | 4 ++-- src/resources/markdown.css | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/hgmarkdownhighlighter.cpp b/src/hgmarkdownhighlighter.cpp index 6ec1c6b1..c87bc3a3 100644 --- a/src/hgmarkdownhighlighter.cpp +++ b/src/hgmarkdownhighlighter.cpp @@ -32,8 +32,8 @@ HGMarkdownHighlighter::HGMarkdownHighlighter(const QVector &s : QSyntaxHighlighter(parent), parsing(0), waitInterval(waitInterval), content(NULL), capacity(0), result(NULL) { - codeBlockStartExp = QRegExp("^```"); - codeBlockEndExp = QRegExp("^```$"); + codeBlockStartExp = QRegExp("^(\\s)*```"); + codeBlockEndExp = QRegExp("^(\\s)*```$"); codeBlockFormat.setForeground(QBrush(Qt::darkYellow)); for (int index = 0; index < styles.size(); ++index) { if (styles[index].type == pmh_VERBATIM) { diff --git a/src/resources/markdown.css b/src/resources/markdown.css index b1d3d2f8..d03fe804 100644 --- a/src/resources/markdown.css +++ b/src/resources/markdown.css @@ -116,6 +116,37 @@ hr { color: #999; } +table { + padding: 0; + border-collapse: collapse; +} +table tr { + border-top: 1px solid #cccccc; + background-color: white; + margin: 0; + padding: 0; +} +table tr:nth-child(2n) { + background-color: #f8f8f8; +} +table tr th { + font-weight: bold; + border: 1px solid #cccccc; + margin: 0; + padding: 6px 13px; +} +table tr td { + border: 1px solid #cccccc; + margin: 0; + padding: 6px 13px; +} +table tr th :first-child, table tr td :first-child { + margin-top: 0; +} +table tr th :last-child, table tr td :last-child { + margin-bottom: 0; +} + /* Code below this line is copyright Twitter Inc. */ button,