emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/treesit-fold 8386b5b714 280/417: feat: Add Markdown suppor


From: ELPA Syncer
Subject: [nongnu] elpa/treesit-fold 8386b5b714 280/417: feat: Add Markdown support (#67)
Date: Mon, 1 Jul 2024 10:02:35 -0400 (EDT)

branch: elpa/treesit-fold
commit 8386b5b71433200e26adca1651519987b695cfb6
Author: Jen-Chieh Shen <jcs090218@gmail.com>
Commit: GitHub <noreply@github.com>

    feat: Add Markdown support (#67)
    
    * feat: Add Markdown support
    
    * changelog
    
    * fix indicators
---
 CHANGELOG.md       | 1 +
 README.md          | 6 ++++++
 ts-fold-parsers.el | 5 +++++
 ts-fold-summary.el | 2 +-
 ts-fold.el         | 1 +
 5 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 70162a3bd1..a047e27820 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for 
recommendations on how
 * Add Clojure support (#64)
 * Add Haskell support (#65)
 * Add Perl support (#66)
+* Add Markdown support (#67)
 
 ## 0.1.0
 > Released Oct 18, 2021
diff --git a/README.md b/README.md
index 49a6630c1b..7a80c4fd5f 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,11 @@ to provide code folding based on the tree-sitter syntax tree.
 
 <!-- markdown-toc start - Don't edit this section. Run M-x 
markdown-toc-refresh-toc -->
 
+<!---
+your comment goes here
+and here
+-->
+
 **Table of Contents**
 
 - [💾 Installation](#-installation)
@@ -120,6 +125,7 @@ These languages are fairly complete:
 - Haskell / HTML
 - Java / JavaScript / JSX / JSON / Julia
 - Lua
+- Markdown
 - Nix
 - Perl / PHP / Python
 - R / Ruby / Rust
diff --git a/ts-fold-parsers.el b/ts-fold-parsers.el
index afb6ce6004..14b361b925 100644
--- a/ts-fold-parsers.el
+++ b/ts-fold-parsers.el
@@ -232,6 +232,11 @@
     (repeat_statement     . ts-fold-range-lua-repeat)
     (comment              . ts-fold-range-lua-comment)))
 
+(defun ts-fold-parsers-markdown ()
+  "Rule set for Markdown."
+  '((fenced_code_block . (ts-fold-range-seq 2 -2))
+    (html_block        . ts-fold-range-html)))
+
 (defun ts-fold-parsers-nix ()
   "Rule set for Nix."
   '((attrset_expression . ts-fold-range-seq)
diff --git a/ts-fold-summary.el b/ts-fold-summary.el
index e92b8acc0b..63585f4f56 100644
--- a/ts-fold-summary.el
+++ b/ts-fold-summary.el
@@ -154,7 +154,7 @@ type of content by checking the word boundary's existence."
 
 (defun ts-fold-summary-markdown (doc-str)
   "Extract summary from DOC-STR in Markdown block."
-  (ts-fold-summary--doc-extract doc-str '()))
+  (ts-fold-summary--doc-extract doc-str '("-" "```")))
 
 (defun ts-fold-summary-org (doc-str)
   "Extract summary from DOC-STR in Org block."
diff --git a/ts-fold.el b/ts-fold.el
index 0eb0ba7d5a..40338d9ee5 100644
--- a/ts-fold.el
+++ b/ts-fold.el
@@ -82,6 +82,7 @@
     (jsonc-mode      . ,(ts-fold-parsers-json))
     (julia-mode      . ,(ts-fold-parsers-julia))
     (lua-mode        . ,(ts-fold-parsers-lua))
+    (markdown-mode   . ,(ts-fold-parsers-markdown))
     (nix-mode        . ,(ts-fold-parsers-nix))
     (ocaml-mode      . ,(ts-fold-parsers-ocaml))
     (perl-mode       . ,(ts-fold-parsers-perl))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]