madflow / flow-netbeans-markdown

Markdown file support for the NetBeans IDE
MIT License
279 stars 40 forks source link

Embedded Code Syntax Highlighting Feature Request #109

Open wadechandler opened 8 years ago

wadechandler commented 8 years ago

In NetBeans, there are files which support embedded languages such as JSPs, and I must add I do not know the complexity of embedding syntax and languages within the NB plugin/module APIs, but it would be really nice if I have triple-ticks embedded code, with a language identifier, like:

{
    "ids": ["zero", "or", "more", "ids"]
}

the IDE could show me that code in its syntax highlighting, and too, if it could allow me different formatting options when working inside the back ticks. I haven't gotten into the usability as of yet, but I wanted to start with the base idea, and see if it were possible, and if so, if it would be something willing to be supported in the project; I understand if not, and thanks.

This would be to support https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code

stengerh commented 8 years ago

I have toyed with this idea myself. At least in my head, I haven't gotten around to test it. Most of the styling APIs in NetBeans are based on MIME type. If the language identifier is a valid file extension it is possible to look up the corresponding MIME type. At least as long as the user has installed a plugin for the corresponding language.

If anyone has experience with language embedding in NetBeans please feel free to share your experience.

markiewb commented 8 years ago

See the sections

at http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-lexer/index.html

And as always @GeertjanWielenga has some code samples https://blogs.oracle.com/geertjan/entry/embedding_javascript_editor_in_java https://blogs.oracle.com/geertjan/entry/syntax_coloring_for_clojure https://blogs.oracle.com/geertjan/entry/html_embedding_for_freemarker