highlight.js icon indicating copy to clipboard operation
highlight.js copied to clipboard

(CMake) Multi-line comments aren't supported properly

Open thatbakamono opened this issue 1 year ago • 2 comments

Describe the issue Multi-line comments aren't supported properly, highlight.js seems to treat them like single-line comments which start similarly (#)

Which language seems to have the issue? CMake

Are you using highlight or highlightAuto?

highlight

Sample Code to Reproduce

<!DOCTYPE HTML>
<html>
	<head>
		<link rel="stylesheet" href="https://unpkg.com/@highlightjs/[email protected]/styles/default.min.css">
		<script type="module">
			import hljs from 'https://unpkg.com/@highlightjs/[email protected]/es/highlight.min.js';
			import cmake from 'https://unpkg.com/@highlightjs/[email protected]/es/languages/cmake.min.js';

			hljs.registerLanguage('cmake', cmake);
			hljs.highlightAll();
		</script>
	</head>

	<body>
		<pre>
			<code class="language-cmake">
				#[[test
				test
				test]]
			</code>
		</pre>
	</body>
</html>

Expected behavior Everything from #[[ to ]] is treated like a multi-line comment and grayed out

Additional context image

thatbakamono avatar Aug 03 '22 13:08 thatbakamono

@thatbakamono Confirmed, we simply don't know anything about multi-line comments in the grammar currently... this is something that should be super easy to add (there are tons of multi-line comment examples to be found in other grammars)...

If you wanted to take a pass at submitting a PR to resolve this, it'd be very welcome. I've tagged this appropriately.

joshgoebel avatar Aug 03 '22 18:08 joshgoebel

Would you like to make a pass at a PR?

joshgoebel avatar Sep 12 '22 02:09 joshgoebel