diff options
| author | Simeon Simeonov | 2021-09-15 06:26:09 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2021-09-15 06:26:09 +0200 |
| commit | d2789616d100fdf4cc5263c75719616b4f4cbb7a (patch) | |
| tree | a3eaa95f35ae6878f094539edd2b60a2b3f2e672 | |
| parent | 32d6065654ea0b582774cbfda318a79babcffd2b (diff) | |
Update markdown-mode
| -rw-r--r-- | .emacs.d/lisp/markdown-mode.el | 57 |
1 files changed, 49 insertions, 8 deletions
diff --git a/.emacs.d/lisp/markdown-mode.el b/.emacs.d/lisp/markdown-mode.el index b42760e..9c52cd3 100644 --- a/.emacs.d/lisp/markdown-mode.el +++ b/.emacs.d/lisp/markdown-mode.el | |||
| @@ -347,6 +347,13 @@ Math support can be enabled, disabled, or toggled later using | |||
| 347 | :safe 'booleanp | 347 | :safe 'booleanp |
| 348 | :package-version '(markdown-mode . "2.4")) | 348 | :package-version '(markdown-mode . "2.4")) |
| 349 | 349 | ||
| 350 | (defcustom markdown-enable-highlighting-syntax nil | ||
| 351 | "Enable highlighting syntax." | ||
| 352 | :group 'markdown | ||
| 353 | :type 'boolean | ||
| 354 | :safe 'booleanp | ||
| 355 | :package-version '(markdown-mode . "2.5")) | ||
| 356 | |||
| 350 | (defcustom markdown-css-paths nil | 357 | (defcustom markdown-css-paths nil |
| 351 | "List of URLs of CSS files to link to in the output XHTML." | 358 | "List of URLs of CSS files to link to in the output XHTML." |
| 352 | :group 'markdown | 359 | :group 'markdown |
| @@ -842,7 +849,7 @@ Group 2 matches the separating whitespace. | |||
| 842 | Group 3 matches the text.") | 849 | Group 3 matches the text.") |
| 843 | 850 | ||
| 844 | (defconst markdown-regex-line-break | 851 | (defconst markdown-regex-line-break |
| 845 | "[^ \n\t][ \t]*\\( \\)$" | 852 | "[^ \n\t][ \t]*\\( \\)\n" |
| 846 | "Regular expression for matching line breaks.") | 853 | "Regular expression for matching line breaks.") |
| 847 | 854 | ||
| 848 | (defconst markdown-regex-wiki-link | 855 | (defconst markdown-regex-wiki-link |
| @@ -861,7 +868,7 @@ Group 5 matches the second component of the wiki link, when present. | |||
| 861 | Group 6 matches the closing square brackets.") | 868 | Group 6 matches the closing square brackets.") |
| 862 | 869 | ||
| 863 | (defconst markdown-regex-uri | 870 | (defconst markdown-regex-uri |
| 864 | (concat "\\(" (regexp-opt markdown-uri-types) ":[^]\t\n\r<>,;() ]+\\)") | 871 | (concat "\\(" (regexp-opt markdown-uri-types) ":[^]\t\n\r<>; ]+\\)") |
| 865 | "Regular expression for matching inline URIs.") | 872 | "Regular expression for matching inline URIs.") |
| 866 | 873 | ||
| 867 | (defconst markdown-regex-angle-uri | 874 | (defconst markdown-regex-angle-uri |
| @@ -1043,6 +1050,15 @@ Group 3 matches all attributes and whitespace following the tag name.") | |||
| 1043 | "\\(&#?[[:alnum:]]+;\\)" | 1050 | "\\(&#?[[:alnum:]]+;\\)" |
| 1044 | "Regular expression for matching HTML entities.") | 1051 | "Regular expression for matching HTML entities.") |
| 1045 | 1052 | ||
| 1053 | (defconst markdown-regex-highlighting | ||
| 1054 | "\\(?1:^\\|[^\\]\\)\\(?2:\\(?3:==\\)\\(?4:[^ \n\t\\]\\|[^ \n\t]\\(?:.\\|\n[^\n]\\)*?[^\\ ]\\)\\(?5:==\\)\\)" | ||
| 1055 | "Regular expression for matching highlighting text. | ||
| 1056 | Group 1 matches the character before the opening equal, if any, | ||
| 1057 | ensuring that it is not a backslash escape. | ||
| 1058 | Group 2 matches the entire expression, including delimiters. | ||
| 1059 | Groups 3 and 5 matches the opening and closing delimiters. | ||
| 1060 | Group 4 matches the text inside the delimiters.") | ||
| 1061 | |||
| 1046 | 1062 | ||
| 1047 | ;;; Syntax ==================================================================== | 1063 | ;;; Syntax ==================================================================== |
| 1048 | 1064 | ||
| @@ -1979,6 +1995,11 @@ For example, this applies to plain angle bracket URLs: | |||
| 1979 | "Face for HTML entities." | 1995 | "Face for HTML entities." |
| 1980 | :group 'markdown-faces) | 1996 | :group 'markdown-faces) |
| 1981 | 1997 | ||
| 1998 | (defface markdown-highlighting-face | ||
| 1999 | '((t (:background "yellow" :foreground "black"))) | ||
| 2000 | "Face for highlighting." | ||
| 2001 | :group 'markdown-faces) | ||
| 2002 | |||
| 1982 | (defcustom markdown-header-scaling nil | 2003 | (defcustom markdown-header-scaling nil |
| 1983 | "Whether to use variable-height faces for headers. | 2004 | "Whether to use variable-height faces for headers. |
| 1984 | When non-nil, `markdown-header-face' will inherit from | 2005 | When non-nil, `markdown-header-face' will inherit from |
| @@ -2171,6 +2192,9 @@ Depending on your font, some reasonable choices are: | |||
| 2171 | (,markdown-regex-strike-through . ((3 markdown-markup-properties) | 2192 | (,markdown-regex-strike-through . ((3 markdown-markup-properties) |
| 2172 | (4 'markdown-strike-through-face) | 2193 | (4 'markdown-strike-through-face) |
| 2173 | (5 markdown-markup-properties))) | 2194 | (5 markdown-markup-properties))) |
| 2195 | (markdown--match-highlighting . ((3 markdown-markup-properties) | ||
| 2196 | (4 'markdown-highlighting-face) | ||
| 2197 | (5 markdown-markup-properties))) | ||
| 2174 | (,markdown-regex-line-break . (1 'markdown-line-break-face prepend)) | 2198 | (,markdown-regex-line-break . (1 'markdown-line-break-face prepend)) |
| 2175 | (markdown-fontify-sub-superscripts) | 2199 | (markdown-fontify-sub-superscripts) |
| 2176 | (markdown-match-inline-attributes . ((0 markdown-markup-properties prepend))) | 2200 | (markdown-match-inline-attributes . ((0 markdown-markup-properties prepend))) |
| @@ -2891,6 +2915,10 @@ When FACELESS is non-nil, do not return matches where faces have been applied." | |||
| 2891 | (match-beginning 4) (match-end 4))) | 2915 | (match-beginning 4) (match-end 4))) |
| 2892 | t))))) | 2916 | t))))) |
| 2893 | 2917 | ||
| 2918 | (defun markdown--match-highlighting (last) | ||
| 2919 | (when markdown-enable-highlighting-syntax | ||
| 2920 | (re-search-forward markdown-regex-highlighting last t))) | ||
| 2921 | |||
| 2894 | (defun markdown-match-math-generic (regex last) | 2922 | (defun markdown-match-math-generic (regex last) |
| 2895 | "Match REGEX from point to LAST. | 2923 | "Match REGEX from point to LAST. |
| 2896 | REGEX is either `markdown-regex-math-inline-single' for matching | 2924 | REGEX is either `markdown-regex-math-inline-single' for matching |
| @@ -5542,10 +5570,10 @@ See also `markdown-mode-map'.") | |||
| 5542 | ["Move Row Down" markdown-move-down | 5570 | ["Move Row Down" markdown-move-down |
| 5543 | :enable (markdown-table-at-point-p) | 5571 | :enable (markdown-table-at-point-p) |
| 5544 | :keys "C-c <down>"] | 5572 | :keys "C-c <down>"] |
| 5545 | ["Move Column Left" markdown-demote | 5573 | ["Move Column Left" markdown-promote |
| 5546 | :enable (markdown-table-at-point-p) | 5574 | :enable (markdown-table-at-point-p) |
| 5547 | :keys "C-c <left>"] | 5575 | :keys "C-c <left>"] |
| 5548 | ["Move Column Right" markdown-promote | 5576 | ["Move Column Right" markdown-demote |
| 5549 | :enable (markdown-table-at-point-p) | 5577 | :enable (markdown-table-at-point-p) |
| 5550 | :keys "C-c <right>"] | 5578 | :keys "C-c <right>"] |
| 5551 | ["Delete Row" markdown-table-delete-row | 5579 | ["Delete Row" markdown-table-delete-row |
| @@ -9446,8 +9474,12 @@ indicate that sorting should be done in reverse order." | |||
| 9446 | (t 1)))) | 9474 | (t 1)))) |
| 9447 | (sorting-type | 9475 | (sorting-type |
| 9448 | (or sorting-type | 9476 | (or sorting-type |
| 9449 | (read-char-exclusive | 9477 | (progn |
| 9450 | "Sort type: [a]lpha [n]umeric (A/N means reversed): ")))) | 9478 | ;; workaround #641 |
| 9479 | ;; Emacs < 28 hides prompt message by another message. This erases it. | ||
| 9480 | (message "") | ||
| 9481 | (read-char-exclusive | ||
| 9482 | "Sort type: [a]lpha [n]umeric (A/N means reversed): "))))) | ||
| 9451 | (save-restriction | 9483 | (save-restriction |
| 9452 | ;; Narrow buffer to appropriate sorting area | 9484 | ;; Narrow buffer to appropriate sorting area |
| 9453 | (if (region-active-p) | 9485 | (if (region-active-p) |
| @@ -9548,10 +9580,18 @@ spaces, or alternatively a TAB should be used as the separator." | |||
| 9548 | ((integerp separator) | 9580 | ((integerp separator) |
| 9549 | (if (< separator 1) | 9581 | (if (< separator 1) |
| 9550 | (user-error "Cell separator must contain one or more spaces") | 9582 | (user-error "Cell separator must contain one or more spaces") |
| 9551 | (format "^ *\\| *\t *\\| \\{%d,\\}" separator))) | 9583 | (format "^ *\\| *\t *\\| \\{%d,\\}\\|$" separator))) |
| 9552 | ((stringp separator) (format "^ *\\|%s" separator)) | 9584 | ((stringp separator) (format "^ *\\|%s" separator)) |
| 9553 | (t (error "Invalid cell separator")))) | 9585 | (t (error "Invalid cell separator")))) |
| 9554 | (while (re-search-forward re end t) (replace-match "| " t t))) | 9586 | (let (finish) |
| 9587 | (while (and (not finish) (re-search-forward re end t)) | ||
| 9588 | (if (eolp) | ||
| 9589 | (progn | ||
| 9590 | (replace-match "|" t t) | ||
| 9591 | (forward-line 1) | ||
| 9592 | (when (eobp) | ||
| 9593 | (setq finish t))) | ||
| 9594 | (replace-match "| " t t))))) | ||
| 9555 | (goto-char begin) | 9595 | (goto-char begin) |
| 9556 | (when markdown-table-align-p | 9596 | (when markdown-table-align-p |
| 9557 | (markdown-table-align)))) | 9597 | (markdown-table-align)))) |
| @@ -9718,6 +9758,7 @@ rows and columns and the column alignment." | |||
| 9718 | ;; not paragraph-ending suffixes: | 9758 | ;; not paragraph-ending suffixes: |
| 9719 | ".* $" ; line ending in two spaces | 9759 | ".* $" ; line ending in two spaces |
| 9720 | "^#+" | 9760 | "^#+" |
| 9761 | "^\\(?: \\)?[-=]+[ \t]*$" ;; setext | ||
| 9721 | "[ \t]*\\[\\^\\S-*\\]:[ \t]*$") ; just the start of a footnote def | 9762 | "[ \t]*\\[\\^\\S-*\\]:[ \t]*$") ; just the start of a footnote def |
| 9722 | "\\|")) | 9763 | "\\|")) |
| 9723 | (setq-local adaptive-fill-first-line-regexp "\\`[ \t]*[A-Z]?>[ \t]*?\\'") | 9764 | (setq-local adaptive-fill-first-line-regexp "\\`[ \t]*[A-Z]?>[ \t]*?\\'") |
