Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python instructions not getting syntax-highlight if inside same code block #27

Closed
h4k1m0u opened this issue Feb 19, 2018 · 2 comments
Closed

Comments

@h4k1m0u
Copy link

h4k1m0u commented Feb 19, 2018

Bug Report or Feature Request (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] question

OS and Version?

Archlinux

Versions

Angular CLI: 1.5.0
Node: 9.5.0
OS: linux x64
Angular: 5.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.0.2
@angular/cli: 1.5.0
@angular/flex-layout: 2.0.0-beta.12
@angular/material: 5.0.2
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.8.1

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:

k_means = cluster.KMeans(n_clusters=2)
l = k_means.fit(X)

This error can be reproduced on stackblitz.

@h4k1m0u h4k1m0u changed the title Two successive python instructions aren't syntax-highlighted Two python instructions aren't syntax-highlighted if inside same code block Feb 19, 2018
@h4k1m0u h4k1m0u changed the title Two python instructions aren't syntax-highlighted if inside same code block Python instructions aren't syntax-highlighted if inside same code block Feb 19, 2018
@h4k1m0u h4k1m0u changed the title Python instructions aren't syntax-highlighted if inside same code block Python instructions not getting syntax-highlight if inside same code block Feb 19, 2018
@MurhafSousli
Copy link
Owner

MurhafSousli commented Feb 19, 2018

@h4k1m0u As I see in the stackblitz, they are getting highlighted. This could be highlightjs python issue
check this

@h4k1m0u
Copy link
Author

h4k1m0u commented Feb 19, 2018

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants