summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimeon Simeonov2022-01-18 22:42:55 +0100
committerSimeon Simeonov2022-01-18 22:42:55 +0100
commita6e0578a86b3713965db1ce45e4fe590321fa756 (patch)
tree39fcf1231e13a2c35e9971da6c4235a4f027912b
parentae4133cda70f515a2d2930dd7e29bcd92ad7d058 (diff)
Update markdown-mode
-rw-r--r--.emacs.d/lisp/markdown-mode.el59
1 files changed, 30 insertions, 29 deletions
diff --git a/.emacs.d/lisp/markdown-mode.el b/.emacs.d/lisp/markdown-mode.el
index a4d08fd..009eed3 100644
--- a/.emacs.d/lisp/markdown-mode.el
+++ b/.emacs.d/lisp/markdown-mode.el
@@ -995,7 +995,7 @@ Compatible with Pandoc, Python Markdown, PHP Markdown Extra, and Leanpub.")
995 "Regular expression for Leanpub section markers and related syntax.") 995 "Regular expression for Leanpub section markers and related syntax.")
996 996
997(defconst markdown-regex-sub-superscript 997(defconst markdown-regex-sub-superscript
998 "\\(?:^\\|[^\\~^]\\)\\(?1:\\(?2:[~^]\\)\\(?3:[[:alnum:]]+\\)\\(?4:\\2\\)\\)" 998 "\\(?:^\\|[^\\~^]\\)\\(?1:\\(?2:[~^]\\)\\(?3:[+-\u2212]?[[:alnum:]]+\\)\\(?4:\\2\\)\\)"
999 "The regular expression matching a sub- or superscript. 999 "The regular expression matching a sub- or superscript.
1000The leading un-numbered group matches the character before the 1000The leading un-numbered group matches the character before the
1001opening tilde or carat, if any, ensuring that it is not a 1001opening tilde or carat, if any, ensuring that it is not a
@@ -2970,7 +2970,8 @@ $..$ or `markdown-regex-math-inline-double' for matching $$..$$."
2970(defun markdown-match-math-double (last) 2970(defun markdown-match-math-double (last)
2971 "Match double quoted $$..$$ math from point to LAST." 2971 "Match double quoted $$..$$ math from point to LAST."
2972 (when markdown-enable-math 2972 (when markdown-enable-math
2973 (when (and (char-equal (char-after) ?$) 2973 (when (and (< (1+ (point)) (point-max))
2974 (char-equal (char-after) ?$)
2974 (char-equal (char-after (1+ (point))) ?$) 2975 (char-equal (char-after (1+ (point))) ?$)
2975 (not (bolp)) 2976 (not (bolp))
2976 (not (char-equal (char-before) ?\\)) 2977 (not (char-equal (char-before) ?\\))
@@ -3383,7 +3384,7 @@ SEQ may be an atom or a sequence."
3383 (margin-char-width (/ margin-pixel-width (default-font-width)))) 3384 (margin-char-width (/ margin-pixel-width (default-font-width))))
3384 (set-window-margins nil margin-char-width)) 3385 (set-window-margins nil margin-char-width))
3385 ;; As a fallback, simply set margin based on character count. 3386 ;; As a fallback, simply set margin based on character count.
3386 (set-window-margins nil markdown-marginalize-headers-margin-width))) 3387 (set-window-margins nil (1+ markdown-marginalize-headers-margin-width))))
3387 3388
3388(defun markdown-fontify-headings (last) 3389(defun markdown-fontify-headings (last)
3389 "Add text properties to headings from point to LAST." 3390 "Add text properties to headings from point to LAST."
@@ -3425,11 +3426,11 @@ SEQ may be an atom or a sequence."
3425 t)) 3426 t))
3426 3427
3427(defun markdown-fontify-tables (last) 3428(defun markdown-fontify-tables (last)
3428 (when (and (re-search-forward "|" last t) 3429 (when (re-search-forward "|" last t)
3429 (markdown-table-at-point-p)) 3430 (when (markdown-table-at-point-p)
3430 (font-lock-append-text-property 3431 (font-lock-append-text-property
3431 (line-beginning-position) (min (1+ (line-end-position)) (point-max)) 3432 (line-beginning-position) (min (1+ (line-end-position)) (point-max))
3432 'face 'markdown-table-face) 3433 'face 'markdown-table-face))
3433 (forward-line 1) 3434 (forward-line 1)
3434 t)) 3435 t))
3435 3436
@@ -3449,27 +3450,27 @@ SEQ may be an atom or a sequence."
3449 3450
3450(defun markdown-fontify-list-items (last) 3451(defun markdown-fontify-list-items (last)
3451 "Apply font-lock properties to list markers from point to LAST." 3452 "Apply font-lock properties to list markers from point to LAST."
3452 (when (and (markdown-match-list-items last) 3453 (when (markdown-match-list-items last)
3453 (not (markdown-code-block-at-point-p (match-beginning 2)))) 3454 (when (not (markdown-code-block-at-point-p (match-beginning 2)))
3454 (let* ((indent (length (match-string-no-properties 1))) 3455 (let* ((indent (length (match-string-no-properties 1)))
3455 (level (/ indent markdown-list-indent-width)) ;; level = 0, 1, 2, ... 3456 (level (/ indent markdown-list-indent-width)) ;; level = 0, 1, 2, ...
3456 (bullet (nth (mod level (length markdown-list-item-bullets)) 3457 (bullet (nth (mod level (length markdown-list-item-bullets))
3457 markdown-list-item-bullets))) 3458 markdown-list-item-bullets)))
3458 (add-text-properties 3459 (add-text-properties
3459 (match-beginning 2) (match-end 2) '(face markdown-list-face)) 3460 (match-beginning 2) (match-end 2) '(face markdown-list-face))
3460 (when markdown-hide-markup 3461 (when markdown-hide-markup
3461 (cond 3462 (cond
3462 ;; Unordered lists 3463 ;; Unordered lists
3463 ((string-match-p "[\\*\\+-]" (match-string 2)) 3464 ((string-match-p "[\\*\\+-]" (match-string 2))
3464 (add-text-properties 3465 (add-text-properties
3465 (match-beginning 2) (match-end 2) `(display ,bullet))) 3466 (match-beginning 2) (match-end 2) `(display ,bullet)))
3466 ;; Definition lists 3467 ;; Definition lists
3467 ((string-equal ":" (match-string 2)) 3468 ((string-equal ":" (match-string 2))
3468 (let ((display-string 3469 (let ((display-string
3469 (char-to-string (markdown--first-displayable 3470 (char-to-string (markdown--first-displayable
3470 markdown-definition-display-char)))) 3471 markdown-definition-display-char))))
3471 (add-text-properties (match-beginning 2) (match-end 2) 3472 (add-text-properties (match-beginning 2) (match-end 2)
3472 `(display ,display-string))))))) 3473 `(display ,display-string))))))))
3473 t)) 3474 t))
3474 3475
3475(defun markdown-fontify-hrs (last) 3476(defun markdown-fontify-hrs (last)