Skip to content

Instantly share code, notes, and snippets.

@fredRos
Last active April 25, 2017 11:46
Show Gist options
  • Save fredRos/d076817d5b25132dde2d6592a8876566 to your computer and use it in GitHub Desktop.
Save fredRos/d076817d5b25132dde2d6592a8876566 to your computer and use it in GitHub Desktop.
Syntax highlighting of doxygen-style markdown in emacs
;; After a part is matched, it is no longer modified
;; => put catch-all patterns last
;; https://www.emacswiki.org/emacs/AddKeywords
;; https://www.emacswiki.org/emacs/RegularExpression
;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Faces-for-Font-Lock.html#Faces-for-Font-Lock
(font-lock-add-keywords 'markdown-mode
;; mark each of three groups differently
;; @section label title
'(("^\\(@section\\) \\(.+?\\) \\(.+?\\)$"
(1 font-lock-constant-face)
(2 font-lock-comment-face)
(3 font-lock-builtin-face))
;; @ref label
("\\(@ref\\)[[:space:]]+?\\(\\_<.+?\\_>\\)"
(1 font-lock-constant-face)
(2 font-lock-comment-face))
;; `@' not treated as part of symbol but look for next symbol end after `@'
("@.+?\\_>" . font-lock-constant-face)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment