Closed h4k1m0u closed 6 years ago
@h4k1m0u As I see in the stackblitz, they are getting highlighted. This could be highlightjs python issue check this
I think I've identified from the code you just shared on stackblitz why it wasn't getting syntax highlighter (i.e. no spans
created inside the code tag). It has to do with the alignment of the code:
This works:
<pre>
<code class="language-python">
k_means = cluster.KMeans(n_clusters=2)
l = k_means.fit(X)
</code>
</pre>
While this doesn't:
<pre>
<code class="language-python">
k_means = cluster.KMeans(n_clusters=2)
l = k_means.fit(X)
</code>
</pre>
Another point, though maybe in this case the problem is coming from highlightjs
:
This won't work:
<pre>
<code class="language-python">
k_means = cluster.KMeans(n_clusters=2)
k_means.fit(X)
</code>
</pre>
But this does work (notice the assignment in the second instruction):
<pre>
<code class="language-python">
k_means = cluster.KMeans(n_clusters=2)
_ = k_means.fit(X)
</code>
</pre>
Bug Report or Feature Request (mark with an
x
)OS and Version?
Archlinux
Versions
Repro steps
The following two
python
instructions won't get syntax-highlighed if they're in the same<pre><code>...</code></pre>
block, but they're normally syntax-highlighted if we put each in a different code block:This error can be reproduced on stackblitz.