-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Update elixir #2773
Update elixir #2773
Conversation
@RunDevelopment those two examples don't capture the extents of this change. I've put together a couple of examples to exemplify these changes. Take for example this codepen and this gist - both have 3 examples, the codepen being the prismjs rendered one and the gist the one that github uses. Prismjs does not parse @doc/@module doc as its own type, it currently returns string, which can't be syntax highlighted as a comment (see example of github). This PR also adds the |
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.
Thanks for the clarification.
One thing aside from my comments:
The goal of the new doc
rule is to enable GitHub-like highlighting, right? If that's the case, then you could also change the attribute
rule to give @doc
and @moduledoc
a special alias. With that alias you could do GitHub-like highlighting in CSS like this:
.token.attribute.special-alias,
.token.attribute.special-alias + .token.string {
color: #888; /* or whatever color you want */
}
No need to add a new doc
rule.
The new doc
rule also has a problem. Neither doc
nor doc-comment
are supported by Prism's standard themes. This means that doc attributes will remain unhighlighted despite being tokenized.
This makes a lot of sense, and it works with @moduledoc """
multiline
documentation
""" I'll push the changes you requested |
Add support for @doc, @moduledoc, atom modules, function call tokens & raise keyword
Co-authored-by: Michael Schmidt <mitchi5000.ms@googlemail.com>
I forgot that some libraries that use Prism under the hood do that. Prism doesn't split code into lines by itself, so I didn't account for this. Yes, my proposed alternative solution doesn't work. |
@RunDevelopment I've updated it with your requests and with a suggested direction on how to deal with @doc/moduledoc. Here's what I think is the right approach with the right compromise
Let me know what you think. |
Sounds good! Let's go with that. |
Co-authored-by: Michael Schmidt <mitchi5000.ms@googlemail.com>
Co-authored-by: Michael Schmidt <mitchi5000.ms@googlemail.com>
Co-authored-by: Michael Schmidt <mitchi5000.ms@googlemail.com>
@RunDevelopment I've addressed all your comments and it's ready for review. |
Co-authored-by: Michael Schmidt <mitchi5000.ms@googlemail.com>
@RunDevelopment I've updated it, should be ready to go 🤞 |
Thank you for contributing @gordalina! |
Add support for @doc, @moduledoc, atom modules, function call tokens & raise keyword