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

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

[nongnu] elpa/markdown-mode 6eea736 1/3: Closes #587 adds option to disa


From: ELPA Syncer
Subject: [nongnu] elpa/markdown-mode 6eea736 1/3: Closes #587 adds option to disable enumeration for ordered lists
Date: Sat, 23 Jan 2021 10:57:14 -0500 (EST)

branch: elpa/markdown-mode
commit 6eea7361c2078bc2ed8dbc2686bb260039af1cd2
Author: bklaase <b.klaase@ethon.nl>
Commit: bklaase <b.klaase@ethon.nl>

    Closes #587 adds option to disable enumeration for ordered lists
---
 markdown-mode.el | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/markdown-mode.el b/markdown-mode.el
index 542de4e..d5ad844 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -427,6 +427,12 @@ The car is used for subscript, the cdr is used for 
superscripts."
   :group 'markdown
   :type 'string)
 
+(defcustom markdown-ordered-list-disable-enumeration nil
+  "Instead of enumerating ('1. 2. 3. etc.') only use '1. '.
+This will by most viewers renderers be accepted as a numbered list"
+  :group 'markdown
+  :type 'boolean)
+
 (defcustom markdown-nested-imenu-heading-index t
   "Use nested or flat imenu heading index.
 A nested index may provide more natural browsing from the menu,
@@ -6048,7 +6054,7 @@ increase the indentation by one level."
                           (>= (forward-line -1) 0))))
             (let* ((old-prefix (match-string 1))
                    (old-spacing (match-string 2))
-                   (new-prefix (if old-prefix
+                   (new-prefix (if (and old-prefix (not 
markdown-ordered-list-disable-enumeration))
                                    (int-to-string (1+ (string-to-number 
old-prefix)))
                                  "1"))
                    (space-adjust (- (length old-prefix) (length new-prefix)))
@@ -6172,8 +6178,11 @@ a list."
          ((or (= (length cpfx) (length pfx))
               (= (length cur-item) (length prev-item)))
           (save-excursion
+            (setq idx (1+ idx))
             (replace-match
-             (concat pfx (number-to-string (setq idx (1+ idx))) ". ")))
+             (if markdown-ordered-list-disable-enumeration
+                 (concat pfx "1. ")
+                 (concat pfx (number-to-string idx) ". "))))
           (setq sep nil))
          ;; indented a level
          ((< (length pfx) (length cpfx))



reply via email to

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