branch: elpa/typst-ts-mode
commit 9d1adbcb0931bb68ad648800c51fdd457398f9ec
Author: Ziqi Yang <mr.ziqiy...@gmail.com>
Commit: Ziqi Yang <mr.ziqiy...@gmail.com>

    feat: adopt update stream parser syntax change and add dynamic height for 
headers
---
 README.md        |  1 +
 typst-ts-mode.el | 14 ++++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 6dae3ba584..2835d6fa56 100644
--- a/README.md
+++ b/README.md
@@ -94,6 +94,7 @@ default, so the `typst watch` process buffer appear when an 
error occurs, and di
 when there is no error. You may find there is only one error at a time, and it 
is
 because Typst itself do this style. You may find 
[auto-save](https://github.com/manateelazycat/auto-save)
 and [super-save](https://github.com/bbatsov/super-save) useful (or annoying).
+6. `typst-ts-markup-header-same-height` and `typst-ts-markup-header-scale` to 
control header height. 
 
 ### Consult Imenu Integration
 If you use [consult](https://github.com/minad/consult) and use `consult-iemnu`
diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index 6ec45c9d2f..7a6dccc7b8 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -312,7 +312,7 @@ is eliminated."
     st))
 
 (defvar typst-ts-mode-font-lock-rules
-  '(;; Typst font locking
+  `(;; Typst font locking
     :language typst
     :feature comment
     ((comment) @font-lock-comment-face)
@@ -323,12 +323,18 @@ is eliminated."
 
     :language typst
     :feature markup-basic
-    ((heading (text) @typst-ts-markup-header-face)
+    (,@(if typst-ts-markup-header-same-height
+           '((heading (text)) @typst-ts-markup-header-face)
+         '((heading "=" (text)) @typst-ts-markup-header-face-1
+           (heading "==" (text)) @typst-ts-markup-header-face-2
+           (heading "===" (text)) @typst-ts-markup-header-face-3
+           (heading "====" (text)) @typst-ts-markup-header-face-4
+           (heading "=====" (text)) @typst-ts-markup-header-face-5))
      (emph) @typst-ts-markup-emphasis-face
      (strong) @typst-ts-markup-strong-face
-     (item "item" @typst-ts-markup-item-face)
+     (item "-" @typst-ts-markup-item-face)
      (term
-      "item" @typst-ts-markup-term-indicator-face
+      "/" @typst-ts-markup-term-indicator-face
       term: (text) @typst-ts-markup-term-term-face
       ":" @typst-ts-markup-term-indicator-face
       (text) @typst-ts-markup-term-description-face)

Reply via email to