-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for embedded markdown formatting #1
Comments
Hi!
This looks really interesting! I will take a look at it in the next couple
of days, hopefully.
I have had some plans to improve highlighting both for things like this but
also for basic HTML tags like <code>...</code>, but haven't found the time
for it yet.
Thanks!
…-- Anders
On Fri, Feb 1, 2019 at 9:58 AM jeberger ***@***.***> wrote:
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`
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/ADBjQPfhL1nrpfn2SkZGN8DVkfrl6d6lks5vJAHCgaJpZM4ad59W>
.
|
Actually it's wrong (this was just a quick port of what I used to have for ;; `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)) ; <- original code had these items directly in the rule without the sublist I'll try and make a proper PR this weekend. |
Thanks!
I think this subject is so complex that I will start with experimenting
with various input Doxygen constructs (I can use the construct in the
Doxygen manual, the ones you supplied, and try to see if I can come up with
some interesting corner cases). I will use this, to see how Doxygen handles
the cases. The next step is to check that your code handles the constructs
in the same way.
Another topic, are you willing to put your code into the public domain?
That way I can use it without having to worry about maintaining a list of
copyright owners. The reason I ask is to simplify transferring the
copyright to the Free Software Foundation, if they would like to include
the package in the Emacs distribution some day.
Unfortunately, my time is limited, so I don't know when I will have time to
actually do this.
…-- Anders
On Fri, Feb 8, 2019 at 8:55 AM jeberger ***@***.***> wrote:
Actually it's wrong (this was just a quick port of what I used to have for
doxymacs-mode). The extra rules should be added to
highlight-doxygen-anchored-keywords-template instead of
highlight-doxygen-compose-font-lock-keywords, and the highlight rule in
each item in the list should be wrapped in a sub-list like this:
;; `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)) ; <- original code had these items directly in the rule without the sublist
I'll try and make a proper PR this weekend.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADBjQPTlIzjoEK3e2oBY1IJ21djK5IxEks5vLS1fgaJpZM4ad59W>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
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:The text was updated successfully, but these errors were encountered: