branch: elpa/typst-ts-mode
commit e9b9881c767acfefc35f10e7a2008e8d5a0a9bf2
Author: Huan Nguyen <nguyenthieuh...@gmail.com>
Commit: meowking <mr.meowk...@tutamail.com>

    fix: #8 headings can be demoted and promoted again
---
 typst-ts-mode.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/typst-ts-mode.el b/typst-ts-mode.el
index b292cf6732..3b85e2e219 100644
--- a/typst-ts-mode.el
+++ b/typst-ts-mode.el
@@ -587,9 +587,13 @@ NODE, PARENT and BOL see `treesit-simple-indent-rules'."
   (treesit-node-text node))
 
 ;; outline-minor-mode
-(defconst typst-ts-mode-outline-regexp "^[[:space:]]*\\(=+\\) "
+(defconst typst-ts-mode-outline-regexp "^[[:space:]]*\\(=+\\)"
   "Regexp identifying Typst header.")
 
+(defconst typst-ts-mode-outline-heading-alist
+  '(("=" . 1) ("==" . 2) ("===" . 3) ("====" . 4) ("=====" . 5) ("======" . 6))
+  "See `outline-heading-alist'.")
+
 (defun typst-ts-mode-outline-level ()
   "Return the level of the heading at point."
   (save-excursion
@@ -755,6 +759,7 @@ typst tree sitter grammar (at least %s)!" 
(current-time-string min-time))
       (setq treesit-outline-predicate (regexp-opt '("section" "source_file")))
     (setq-local outline-regexp typst-ts-mode-outline-regexp)
     (setq-local outline-level #'typst-ts-mode-outline-level))
+  (setq-local outline-heading-alist typst-ts-mode-outline-heading-alist)
   ;; Although without enabling `outline-minor-mode' also works, enabling it
   ;; provides outline ellipsis
   ;; TODO add it to after-hook

Reply via email to