Skip to content
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

Highlight language syntax #15

Open
GoogleCodeExporter opened this issue Mar 16, 2015 · 4 comments
Open

Highlight language syntax #15

GoogleCodeExporter opened this issue Mar 16, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link
Contributor

The language of code should be determined (probably by file extension) and
highlighted.

Original issue reported on code.google.com by [email protected] on 14 Jul 2007 at 10:39

@GoogleCodeExporter
Copy link
Contributor Author

Original comment by [email protected] on 15 Jul 2007 at 8:30

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

@tristone13th
Copy link

Many appreciations for the work, any thoughts on this issue?

@tristone13th
Copy link

I think we can use a simple regex to parse each code change line and add corresponding highlights, do you think it is feasible?

@Qeole
Copy link
Owner

Qeole commented Jan 8, 2023

You'd need a set of regular expressions for all the main languages, I don't want to implement and maintain that. But given that we're already using a library to highlight the diff (https://highlightjs.org/) which does that already, maybe there would be a possibility to reuse it to highlight a short snippet of code. We'd have to parse the diff to reliably extract the file extension and deduce the language, then extract the portion we want to highlight (All code snippets? Just the modified lines?), then highlight them without breaking the formatting of the message (and figure out how to mark additions/deletions on top of that).

Nothing undoable, but that's more work than I can afford to spend on this add-on at the moment. You're welcome to try something if you feel like it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants