-
Notifications
You must be signed in to change notification settings - Fork 743
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 a lexer for emails #1567
Add a lexer for emails #1567
Conversation
I haven't had time to check the spec but I think this needs to be refactored to use |
…2 section 2.2.3 "Long Header Fields".
Thanks for the feedback, @jneen and @pyrmont! I just pushed some changes to address your comments.
Good point; I changed it to use separate states for the headers and body text. (We can't rely specifically on 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.
@smokris I made some changes to make the lexer better conform with the RFC. Let me know what you think.
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 think this is good to merge.
@smokris Was there there anything else on your end?
@smokris I assumed there were no problems and have merged this into master. It will be part of the next release of Rouge, v3.24.0. That's scheduled to go out to Ruby Gems tonight/tomorrow (depending on your time zone). Thanks for the submission! |
Wonderful. Thanks! |
This commit adds a lexer for e-mails. It follows RFC 2822 as well as supporting quoted lines in the form described in RFC 3676. Co-authored-by: Michael Camilleri <mike@inqk.net>
This adds a lexer that highlights email headers (From, To, Cc, Bcc, Date, Subject), quoted text, unquoted text, and signatures.
Email isn't a programming language, but nevertheless I think it could be useful for Rouge to highlight email messages — for example, GitLab uses Rouge to highlight code blocks in Markdown, and my team sometimes copy-pastes emails into GitLab comments surrounded by triple-backtick code fences; this highlighter would make those emails easier to read.