? ?‍? ?‍? Highlighting B4X code in HTML pages using Prism

Erel

B4X founder
Staff member
Licensed User
Longtime User
Example: https://www.b4x.com/js/

Prism is a popular JavaScript text highlighter: https://prismjs.com/index.html

It is the same library that is installed in the forum and highlights the code.
The B4X rules and a modified CSS file are attached.

Note that it is not 100% perfect due to it being a context free parser, overall it does a good job and the code looks much better than plain text.
 

Attachments

  • prism.zip
    9.1 KB · Views: 528
Last edited:

ilan

Expert
Licensed User
Longtime User

Erel

B4X founder
Staff member
Licensed User
Longtime User
very good! like this we can show b4x code in a webview in our app.
Haven't thought about it but it should work. Another option: https://www.b4x.com/android/forum/t...e-parser-b4x-code-highlighter.109308/#content

java_QIDqgmNTqq.png


Haven't you "recently" posted such (similar) a thing?
True, but it required several additional steps to be actually used.
 
Top