saneef / eleventy-plugin-asciidoc

Eleventy plugin to add support for AsciiDoc.
MIT License
26 stars 7 forks source link

Syntax highlighting #1

Closed jouni closed 2 years ago

jouni commented 2 years ago

Would it be possible to add syntax highlighting support for source code blocks?

So that, for example, the following AsciiDoc source would be nicely highlighted in the output:

[source,html]
----
<body>
  <p>This is some HTML</p>
</body>
----
saneef commented 2 years ago

AsciiDoc will convert above snippet to:

<pre class="highlight"><code class="language-html" data-lang="html">&lt;body&gt;
  &lt;p&gt;This is some HTML&lt;/p&gt;
  &lt;/body&gt;</code></pre>

You'll have to use Eleventy syntax highlight plugin to highlight syntax.

jouni commented 2 years ago

I did try that, but for some reason the HTML is unchanged in the output. The syntax highlight plugin doesn't seem to process it. But I assume it should work, so I’ll give it another go. Quite new to 11ty in general, so I might have missed something obvious.

Thanks in any case for the nice AsciiDoc plugin!

saneef commented 2 years ago

My bad, Eleventy syntax highlight plugin doesn't solve the problem.

Here in this sample project I have used highlight.js to highlight code on the front end.

jouni commented 2 years ago

Right, so that does the highlighting on the client side. Thanks again!