-
Notifications
You must be signed in to change notification settings - Fork 634
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 Org-Mode lexer #2628
Add Org-Mode lexer #2628
Conversation
855af33
to
66e62e8
Compare
755a7a7
to
66b087c
Compare
This is a direct translation from the work done by @kaushalmodi in GoChroma, as per this comment: pygments#426 (comment) Includes improvements done to the Chroma lexer at a later date.
# Source Code Blocks | ||
(r'(?i)^( *#\+begin_src )([^ \n]+)(.*?\n)([\w\W]*?)(^ *#\+end_src *$)', bygroups(Comment, Comment.Special, Comment, using(this), Comment)), |
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.
This could certainly be improved to use the appropriate lexer to highlight the code inside the code block (like it's done in the Markdown lexer), but this is a bit beyond my expertise. I would welcome contributions.
The usual code block format is like this (lifted from my literate Emacs config):
#+begin_src emacs-lisp :tangle yes
(setq undo-limit 80000000
evil-want-fine-undo t
truncate-string-ellipsis "…")
#+end_src
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.
(I only had the time to start a review.)
Thank you @jeanas, I appreciate your time! I've made the changes you've requested, please let me know if anything else could be improved. |
Hi @jeanas, I've pushed changes to address the issues raised by the last CI run. Could you please run the workflow again? Thank you! |
@goshatch There are a few things I'd like to fix up in the PR before merging it, but I cannot push code here because you opened the PR from the |
Thank you @jeanas, and noted about feature branches. |
Hello,
This PR adds a new lexer for the Emacs Org-Mode. It is basically a direct translation of the work done by @kaushalmodi for Go's Chroma library, which I came across in #426 (comment).
I have to say that I am familiar with neither Python nor Go; my reason for wanting this lexer is so that my forge of choice (Sourcehut) which uses
pygments
would syntax highlight my org files 😁Therefore, I would like to ask for help on this PR, and I am marking it as draft. Currently, the test for the lexer is failing (I'm adding the output below). I don't know enough about the Python ecosystem to debug it myself, and I hope someone here would be able to assist.Thank you for your consideration!