Notepad++ incorrect syntax highlithing?

Posted by user360919 on Super User See other posts from Super User or by user360919
Published on 2014-08-23T16:08:48Z Indexed on 2014/08/23 16:25 UTC
Read the original article Hit count: 147

Filed under:
|
|

So I want to build a XHTML 1.0 Strict based website. Using Notepad++ for syntax highlighting came as an idea to me. But when I tried to put the XML declaration (as stated in the spec, proper XHTML pages should use a XML declaration and be served as application/xhtml+xml) I can't get the entire document highlighted propperly. Here is the code I used for a basic page:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
    <head>
        <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
        <title>Page</title>
        <script type="application/javascript">
                alert("A perfectly valid xHTML page...");
        </script>
        <style type="text/css">
                #test {
                    text-align: center;
                }
        </style>
    </head>
    <body>
        <h1 id="test">TEST</h1>
    </body>
</html>

Paste this in Notepad++ and you'll see that it won't highlight the code between <script type="application/javascript"> and </script> (it renders its background white) if language is set to XML. If I set the language to HTML, then the script gets correctly highlighted but the XML declaration is not. What to do? How to make a hybrid language - combination of XML and HTML?

© Super User or respective owner

Related posts about notepad++

Related posts about Xml