From 484acddba300ab5724a26a7ee5337ec54bc8f986 Mon Sep 17 00:00:00 2001 From: ema Date: Wed, 9 Jul 2025 00:12:52 +0800 Subject: [PATCH] Add reStructuredText syntax highlighting Just a simple highlighting solution for `.rst` files --- .../Syntax/Dark/ReStructuredText.xshd | 74 +++++++++++++++++++ .../Syntax/Light/ReStructuredText.xshd | 74 +++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 QuickLook.Plugin/QuickLook.Plugin.TextViewer/Syntax/Dark/ReStructuredText.xshd create mode 100644 QuickLook.Plugin/QuickLook.Plugin.TextViewer/Syntax/Light/ReStructuredText.xshd diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Syntax/Dark/ReStructuredText.xshd b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Syntax/Dark/ReStructuredText.xshd new file mode 100644 index 0000000..a6db694 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Syntax/Dark/ReStructuredText.xshd @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + ^.+\r?\n[=\-`:'\"~^_*+#<>]{4,}\s*$ + + + + ^[=\-`:'\"~^_*+#<>]{4,}\s*\r?\n.+\r?\n[=\-`:'\"~^_*+#<>]{4,}\s*$ + + + + \*\*[^\s*].*?[^\s*]\*\* + + + + \*[^\s*].*?[^\s*]\* + + + + ``.*?`` + + + + ^\.\.\s+\w+::.*$ + + + + :\w+:`[^`]*` + + + + `[^`]+\s+<[^>]+>`_ + + + + \w+_ + + + + ^\.\.\s.*$ + + + + ^::\s*$ + ^(?!\s) + + + + ^[ \t]+\S + ^(?![ \t]) + + + + ^[ \t]+ + ^(?![ \t]) + + + \ No newline at end of file diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Syntax/Light/ReStructuredText.xshd b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Syntax/Light/ReStructuredText.xshd new file mode 100644 index 0000000..a133d39 --- /dev/null +++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Syntax/Light/ReStructuredText.xshd @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + ^.+\r?\n[=\-`:'\"~^_*+#<>]{4,}\s*$ + + + + ^[=\-`:'\"~^_*+#<>]{4,}\s*\r?\n.+\r?\n[=\-`:'\"~^_*+#<>]{4,}\s*$ + + + + \*\*[^\s*].*?[^\s*]\*\* + + + + \*[^\s*].*?[^\s*]\* + + + + ``.*?`` + + + + ^\.\.\s+\w+::.*$ + + + + :\w+:`[^`]*` + + + + `[^`]+\s+<[^>]+>`_ + + + + \w+_ + + + + ^\.\.\s.*$ + + + + ^::\s*$ + ^(?!\s) + + + + ^[ \t]+\S + ^(?![ \t]) + + + + ^[ \t]+ + ^(?![ \t]) + + + \ No newline at end of file