-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
It would be nice if embedded markdown formatting were recognized. Today I have the following in my configuration to add support for bold, italic and code:
(defun jmb/doxygen-add-markdown (rules)
(-concat
rules
`(
;; Markdown
;; `code` not code `code`again` not`code`embedded `code``again`
;; `code`, not code `code again`` not code `code`
(,(rx space
(group ?` (not (any space "\r\n`"))
(* (or (not (any ?`))
(: (+ ?`) (not (any space punctuation "\r\n")))))
(+ ?`))
(or (any space punctuation "\r\n") eol))
1 (quote underline) prepend nil)
;; *italic* not italic *italic*again* not*italic*embedded *italic**again*
;; *italic*, not italic *italic again** not italic *italic*
;; _italic_ not italic _italic_again_ not_italic_embedded _italic__again_
;; _italic_, not italic _italic again__ not italic _italic_
(,(rx space
(group
(or (: ?* (not (any space "\r\n*"))
(* (or (not (any ?*))
(: (+ ?*) (not (any space punctuation "\r\n")))))
?*)
(: ?_ (not (any space "\r\n_"))
(* (or (not (any ?_))
(: (+ ?_) (not (any space punctuation "\r\n")))))
?_)))
(or (any space punctuation "\r\n") eol))
1 (quote italic) prepend nil)
;; **bold** not bold **bold*again** not**bold**embedded **bold***again**
;; **bold**, not bold **bold again*** not bold **bold**
;; __bold__ not bold __bold_again__ not__bold__embedded __bold___again__
;; __bold__, not bold __bold again___ not bold __bold__
(,(rx space
(group
(or (: "**" (not (any space "\r\n*"))
(* (or (: (? ?*) (not (any ?*)))
(: (+ "*") (not (any space punctuation "\r\n")))))
"**")
(: "__" (not (any space "\r\n_"))
(* (or (: (? ?_) (not (any ?_)))
(: (+ "_") (not (any space punctuation "\r\n")))))
"__")))
(or (any space punctuation "\r\n") eol))
1 (quote bold) prepend nil)
)))
(advice-add
#'highlight-doxygen-compose-font-lock-keywords
:filter-return
#'jmb/doxygen-add-markdown)Note that highlight-doxygen already has basic support for "code" format using backticks, but the current support is broken: the following text is not properly formatted:
`code` not code `code`again` not`code`embedded `code``again`
`code`, not code `code again`` not code `code`
Metadata
Metadata
Assignees
Labels
No labels