-
Notifications
You must be signed in to change notification settings - Fork 78
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 syntax color to ocamldoc markup #1365
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the very detailed PR. The highlighting changes look great!
I only have a few implementation comments:
9f09c40
to
b650be5
Compare
b650be5
to
3ba7180
Compare
I've also added a small change to fix #1014, (simply removing the global scope name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
A few ocamldoc markup had syntax color, but most didn't. This PR adds color to most markup, using the similar markup in markdown for the textmate scope. For reference, I used the following:
Changes
Before this PR, only few constructs had syntax coloring:
@tags
[inline code]
(note that inline code is rendered using ocaml's syntax highlighting, and not semantic highlighting. Depending on theme, the colors may be very different from the rest of the file).I added the following:
{b bold]
{1 heading]
{i italic]
{e emph}
(colored the same as their markdown equivalents){^ exponent}
{_ index}
, likely not colored in most themes (namedmarkup.exponent.ocamldoc
){m math}
and{math math-block}
, odoc extension, colored the same as latex math (which issupport.class
for some reason...){[ocaml code block]}
{v verbatim v}
and{@lang[ other language code block]}
(odoc extension), colored as markdown code block{{: link}link-text}
{!reference}
and{!type:reference]
, as well as{{!reference}alt-text}
. I'm not really satisfied with the later though, as I can't color bothreference
as ocaml code andalt-text
as markup (tm grammar don't have abegin
/middle
/end
sadly).-
) and complex{ul {li item}}
{%latex: latex code%}
and{%html: html code %}
as well as others (rendered as verbatim code)@raise Exn
,@raises Exn
,@param id
,@see "document"
,@see 'file'
and@see <url>
I haven't added the following:
{C center}
,{L left}
and{R right}
(not supported by odoc){!indexlist}
(not supported by odoc)Test comment
Here is a comment showing off the new color highlights that can be used to test them with different themes: