Help save net neutrality! Learn more.

BUG: No syntax highlighting for Css in Html

Hugh Dog
  • Hugh Dog

    Hugh Dog - 2012-05-14

    Common practice for user to have Html file that contains a block for JavaScript and a block for Css inside the Html file.

    JavaScript syntax highlighting works OK inside Html file.

    BUG: Css syntax highlighting does not work inside Html file.

    Css syntax highlight works OK when viewed in external .Css file.

    To be consistent, Css syntax highlight needs to work inside of Html file when contained within a block like this:

            <style type="text/css">
                /* .hidden {display:none} */
                .errorMessage {color: red}
                .successMessage {color: green}

    Others have reported the bug since 2005 in this forum.

  • cchris

    cchris - 2012-05-17

    Scintilla still has no nested lexers - that's too bad.
    I heard that the PowerShell external lexer plugin was able to highlight this properly. Haven't tried it, and it could be broken after changes in Scintilla v2.20. Take a chance.


  • Max

    Max - 2012-11-02

    As much as I love NP++, I can't believe nobody was able to implement this in seven years and more. I have the same problem with ASP.NET delimiters in aspx files. Although the logic should be quite easy: just match the opening delimiter and change color coding style to xy until closing delimiter. Instead of relying on the file suffix to identify the color coding, which is obviously not applicable anymore in modern software development. Isn’t there any workaround for this?

  • Michel Merlin

    Michel Merlin - 2013-04-11

    Nested HTML+JS+STYLES instructions AND THEIR COMMENTS difficult yet urgent

    I agree that definitions, parsing, handling, color-coding, treatments of styles should be done by the same directive (at the W3C level) or program component (in browsers, editors and other apps) whether inside a .CSS file, a <style></style> pair, or a style="attribute: value; ..." inline specification. Sure would remain the styles specified as attributes in HTML tags (e.g. "width=70" inside IMG tags), but that coordination would be easied.

    Now for nested instructions, reliably solving the problem is more difficult, and above all more time consuming, than it looks at 1st glance, see e.g. Nested Comments' WRONG MATCH in Notepad++ and HTML Tidy, and the rest of this thread, which are nevertheless just the premises of the nested HTML+JS+STYLES that people have been so strongly awaiting for so long.

    Versailles, Thu 11 Apr 2013 19:57:00 +0200

    Last edit: Michel Merlin 2013-04-11