[Discussion] future of syntax highlighting #1180

Open
opened 2022-08-05 16:42:40 +00:00 by qwerty287 · 1 comment
Contributor

We're currently using my Prism4j fork for syntax highlighting. Unfortunately, this will be incompatible with the CodeView (#1166), and @mmarif already added some languages (Go, Python and Python). The main issue is that we shouldn't duplicate the languages. If we switch to CodeView, we should drop Prism4j. I could (try to) migrate the MD syntax highlighter and the file viewer to the language definitions of the CodeView. But three languages are not enough. We should add some more languages, maybe not everything supported by Prism4j, but the most important languages. I'll list some languages I'd say that are necessary to replace Prism4j:

Done

  • Go
  • Python
  • Java
  • PHP
  • XML
  • HTML
  • JSON
  • JavaScript / TypeScript (TS is basically JS with some more keywords)
  • C
  • C++

Extending languages

  • maybe C#
  • Shell / Bash
  • Markdown
  • CSS
  • Groovy (Gradle build scripts)
  • INI
  • Kotlin
  • Makefile
  • SQL
  • YAML
  • Rust
  • Swift
  • Ruby
  • Perl

Probably, we can look at Prism4j's definitions here that are helpful (they are very detailed).
We should also check that the highlighting quality is comparable to the current one.

Do you have more languages to add here?
Otherwise, we should try to implement them step by step.

We're currently using my Prism4j fork for syntax highlighting. Unfortunately, this will be incompatible with the CodeView (https://codeberg.org/gitnex/GitNex/issues/1166), and @mmarif already added some languages (Go, Python and Python). The main issue is that we shouldn't duplicate the languages. If we switch to CodeView, we should drop Prism4j. I could (try to) migrate the MD syntax highlighter and the file viewer to the language definitions of the CodeView. But three languages are not enough. We should add some more languages, maybe not everything supported by Prism4j, but the most important languages. I'll list some languages I'd say that are necessary to replace Prism4j: ## Done - Go - Python - Java - PHP - XML - HTML - JSON - JavaScript / TypeScript (TS is basically JS with some more keywords) - C - C++ ## Extending languages - maybe C# - Shell / Bash - Markdown - CSS - Groovy (Gradle build scripts) - INI - Kotlin - Makefile - SQL - YAML - Rust - Swift - Ruby - Perl Probably, we can look at Prism4j's definitions here that are helpful (they are very detailed). We should also check that the highlighting quality is comparable to the current one. Do you have more languages to add here? Otherwise, we should try to implement them step by step.
qwerty287 added the
💬 Discussion
label 2022-08-05 16:42:40 +00:00
Author
Contributor
We can also look at https://github.com/kbiakov/CodeView-Android/tree/master/codeview/src/main/java/io/github/kbiakov/codeview/highlight/prettify/lang and https://github.com/massivemadness/Squircle-IDE/tree/master/languages for some language definitions.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitnex/GitNex#1180
No description provided.