<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CSS comments should be in GREEN]]></title><description><![CDATA[<p dir="auto">Why are CSS comments in BLACK when all other comments are GREEN?<br />
<img src="/assets/uploads/files/1695137838217-comments-resized.png" alt="comments.PNG" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/topic/24940/css-comments-should-be-in-green</link><generator>RSS for Node</generator><lastBuildDate>Sun, 16 Aug 2026 01:16:16 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/24940.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Sep 2023 15:37:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CSS comments should be in GREEN on Wed, 04 Oct 2023 01:54:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gulshan-negi-0" aria-label="Profile: Gulshan-Negi-0">@<bdi>Gulshan-Negi-0</bdi></a> said in <a href="/post/89652">CSS comments should be in GREEN</a>:</p>
<blockquote>
<p dir="auto">Well, in my opinion and knowledge, the comment color of CSS is customizable, which means you can change the color of CSS comments.</p>
</blockquote>
<p dir="auto">This topic is about inline CSS between <code>&lt;style&gt;...&lt;/style&gt;</code> tags in HTML documents. You are talking about standalone style sheets with the <code>*.css</code> extension.</p>
<p dir="auto">To demonstrate that you cannot set the style of inline CSS in HTML files, you can try the following:</p>
<ol>
<li>Save this markup as <code>index.html</code>:</li>
</ol>
<pre><code class="language-html">&lt;html&gt;
    &lt;style type="text/css"&gt;
      /* comment */
    &lt;/style&gt;
&lt;/html&gt;
</code></pre>
<ol start="2">
<li>Open <code>index.html</code> in any published version of Notepad++</li>
<li>Go to <code>Settings &gt; Style Configurator</code></li>
<li>Select “Language: CSS”</li>
<li>Select “Style: Comment”</li>
<li>Change the style and save</li>
<li>Observe that nothing happens</li>
</ol>
<p dir="auto"><img src="/assets/uploads/files/1696384328580-html-with-inline-style-npp.8.5.7-002.png" alt="html-with-inline-style-npp.8.5.7-002.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Now select <code>CSS</code> from the language menu at <code>Language &gt; C &gt; CSS</code>, and observe that CSS comments are styled as specified in <code>Style Configurator</code>:</p>
<p dir="auto"><img src="/assets/uploads/files/1696384358480-style-sheet-npp.8.5.7-002.png" alt="style-sheet-npp.8.5.7-002.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/89666</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/89666</guid><dc:creator><![CDATA[rdipardo]]></dc:creator><pubDate>Wed, 04 Oct 2023 01:54:44 GMT</pubDate></item><item><title><![CDATA[Reply to CSS comments should be in GREEN on Tue, 03 Oct 2023 17:03:33 GMT]]></title><description><![CDATA[<p dir="auto">Well, in my opinion and knowledge, the comment color of CSS is customizable, which means you can change the color of CSS comments.<br />
Thanks</p>
]]></description><link>https://community.notepad-plus-plus.org/post/89652</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/89652</guid><dc:creator><![CDATA[Gulshan Negi 0]]></dc:creator><pubDate>Tue, 03 Oct 2023 17:03:33 GMT</pubDate></item><item><title><![CDATA[Reply to CSS comments should be in GREEN on Tue, 03 Oct 2023 02:34:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/deleelee" aria-label="Profile: deleelee">@<bdi>deleelee</bdi></a> said in <a href="/post/89633">CSS comments should be in GREEN</a>:</p>
<blockquote>
<p dir="auto">This is a perfect example of when it would be great to be able to load a default language into the User Defined Language window and make changes.</p>
</blockquote>
<ol>
<li><strong>You <em>can</em> change the appearance of the lexer for a default language, just not in the UDL window.</strong>
<ul>
<li>Instead, you go from main menu to <code>Style Configurator-&gt;&lt;language name&gt;</code>, choose a style name from the <code>Style</code> list, and customize that style. For more info, <a href="https://npp-user-manual.org/docs/preferences/#style-configurator" rel="nofollow ugc">see the user manual</a>.</li>
</ul>
</li>
<li><strong>You can’t use the UDL editor to edit default languages because <em>they weren’t made using the UDL system.</em></strong> As rdipardo explained above, the <a href="https://github.com/ScintillaOrg/lexilla/blob/master/lexers/LexHTML.cxx" rel="nofollow ugc">lexer for HTML</a> was written in C/C++ because the UDL system is not powerful enough to capture the intricacies of HTML syntax.</li>
</ol>
]]></description><link>https://community.notepad-plus-plus.org/post/89638</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/89638</guid><dc:creator><![CDATA[Mark Olson]]></dc:creator><pubDate>Tue, 03 Oct 2023 02:34:08 GMT</pubDate></item><item><title><![CDATA[Reply to CSS comments should be in GREEN on Tue, 03 Oct 2023 01:25:26 GMT]]></title><description><![CDATA[<p dir="auto">This is a perfect example of when it would be great to be able to load a default language into the User Defined Language window and make changes.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/89633</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/89633</guid><dc:creator><![CDATA[deleelee]]></dc:creator><pubDate>Tue, 03 Oct 2023 01:25:26 GMT</pubDate></item><item><title><![CDATA[Reply to CSS comments should be in GREEN on Wed, 20 Sep 2023 20:23:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mkupper" aria-label="Profile: mkupper">@<bdi>mkupper</bdi></a> said in <a href="/post/89376">CSS comments should be in GREEN</a>:</p>
<blockquote>
<p dir="auto">If I am viewing an .htm file that contains a &lt;script&gt;…&lt;/script&gt; is the lexer/formatter/highlighter/colorizer code at all related to the lexer/formatter/highlighter/colorizer code that would process the same chunk of JavaScript in a .js file? Or are they 100% unrelated code paths and updated/maintained independently?</p>
</blockquote>
<p dir="auto">HTML is styled by <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/lexilla/lexers/LexHTML.cxx" rel="nofollow ugc">this lexer module</a>, which defines styles for all generic SGML markup (XML included) as well as (very basic) JavaScript, ASP and JSP scripts, and (Python) Mako templates, but not <code>&lt;style&gt;</code> elements.</p>
<p dir="auto">There is <em>also</em> <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/lexilla/lexers/LexCSS.cxx" rel="nofollow ugc">a complete module</a> for independent style sheets with the <code>*.css</code> or <code>*.scss</code> extension.</p>
<p dir="auto">It’s well documented that there’s no styling of embedded CSS in HTML documents. You can read through this (partial) list of open bug reports, the oldest dating from 2005:</p>
<ul>
<li><a href="https://sourceforge.net/p/scintilla/bugs/341" rel="nofollow ugc">“No CSS highlighting inside HTML file”</a></li>
<li><a href="https://sourceforge.net/p/scintilla/feature-requests/470" rel="nofollow ugc">“Embedded CSS highlighting bug”</a></li>
<li><a href="https://sourceforge.net/p/scintilla/feature-requests/843" rel="nofollow ugc">“Multiple Lexers for HTML files”</a></li>
<li><a href="https://sourceforge.net/p/scintilla/feature-requests/1430" rel="nofollow ugc">“Scintilla HTML code style recognition”</a></li>
<li><a href="https://sourceforge.net/p/scintilla/feature-requests/1438" rel="nofollow ugc">“&lt;style&gt; tag do[es]n’t highlighting in php file in &lt;html&gt; tag”</a></li>
</ul>
<p dir="auto">There really is no simple way to programmatically switch between completely different lexer modules in the same editing window. Scintilla is basically a synchronous, single-threaded service running inside the application (despite the addition last year of <a href="https://groups.google.com/g/scintilla-interest/c/_W6NGQ5WNoE" rel="nofollow ugc">optional parallelization for line layout</a>).</p>
<p dir="auto">What VS Code and other Textmate-based editors are doing is basically regex matching. The <a href="https://github.com/Ekopalypse/EnhanceAnyLexer#readme" rel="nofollow ugc">EnhanceAnyLexer</a> plugin for N++ can provide something like that by setting custom styles for portions of the document that match a user-defined regex.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/89390</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/89390</guid><dc:creator><![CDATA[rdipardo]]></dc:creator><pubDate>Wed, 20 Sep 2023 20:23:53 GMT</pubDate></item><item><title><![CDATA[Reply to CSS comments should be in GREEN on Wed, 20 Sep 2023 16:39:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mark-olson" aria-label="Profile: Mark-Olson">@<bdi>Mark-Olson</bdi></a> I don’t know much about the lexer stuff and Lexilla but have some questions related to your comment about “Lexilla has to reinvent the wheel whenever it wants to have different languages in the same document.”</p>
<p dir="auto">If I am viewing an .htm file that contains a &lt;script&gt;…&lt;/script&gt; is the lexer/formatter/highlighter/colorizer code at all related to the lexer/formatter/highlighter/colorizer code that would process the same chunk of JavaScript in a .js file? Or are they 100% unrelated code paths and updated/maintained independently?</p>
<p dir="auto">If I copy/paste the CSS from within the &lt;style&gt;…&lt;/style&gt; section of an .htm file into a .css file I see that the css is colored nicely, including green comments. I assume that means people have written and maintain a css lexer/formatter/highlighter/colorizer that works with Notepad++.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/89376</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/89376</guid><dc:creator><![CDATA[mkupper]]></dc:creator><pubDate>Wed, 20 Sep 2023 16:39:15 GMT</pubDate></item><item><title><![CDATA[Reply to CSS comments should be in GREEN on Tue, 19 Sep 2023 21:11:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sanford-arbogast" aria-label="Profile: Sanford-Arbogast">@<bdi>Sanford-Arbogast</bdi></a><br />
TLDR: This seems like a problem that will probably never be fixed.</p>
<p dir="auto">It would seem that the reason for this is that the HTML lexer for Notepad++ does not have a built-in sub-lexer for CSS, but it does have one for JavaScript.</p>
<p dir="auto">That is, when Notepad++ is colorizing an HTML document, if it detects a <code>&lt;script&gt;</code> tag, it goes into a new state where it colorizes based on JavaScript syntax rather than HTML syntax. But because it has no sub-lexer for CSS, when it hits a <code>&lt;style&gt;</code> tag, it treats the contents as plain old text.</p>
<p dir="auto">Unfortunately the Lexilla library that Notepad++ uses for syntax coloring is rather low-powered compared to say, the TextMate-based lexer for VSCode, so whereas VSCode can divide a document up into sections that are each colored according to completely different lexers, Lexilla has to reinvent the wheel whenever it wants to have different languages in the same document. This means that a seemingly simple idea like “use CSS rules for syntax coloring inside of <code>&lt;style&gt;</code> tags” has a lot of programming overhead for Notepad++ that makes this kind of problem unusually irritating.</p>
<p dir="auto">That’s not to say you couldn’t hack together your own workaround. But unfortunately nobody is likely to ride in to save the day here.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/89360</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/89360</guid><dc:creator><![CDATA[Mark Olson]]></dc:creator><pubDate>Tue, 19 Sep 2023 21:11:37 GMT</pubDate></item></channel></rss>