2

In an application that I'm developing my goal would be to have highlighted code for some language, i.e. Java, and make so that some elements of code (functions, parameters) are clickable.

I understood that I need some js-based syntax highlighter capable to output raw html instead of linking a CSS stylesheet to the code.

What I still don't get is:

  1. Is there any highlighter that ouputs highlighted code in such format?
  2. How to make just some words clickable?
  3. Is there any alternative to this strategy?

UPDATE1: As first attempt, I downloaded the source code of the android-codepad project, and edited the HTMLViewerPlusPlus class so that it highlights the HTML and, instead of showing it in a WebView, it shows it in a TextView, but since codepad uses css styling, I'm not getting the proper results. I'd need a new alternative that generates hard-styled html code.

UPDATE2: Using jsoup library with this method I managed to parse the code so that I get inline style attribute for each html element, but how to convert css styles to html tags?

Community
  • 1
  • 1
Vektor88
  • 4,841
  • 11
  • 59
  • 111

0 Answers0