Highlight.js: js partial syntax highlighting

Created on 25 Oct 2020  路  13Comments  路  Source: highlightjs/highlight.js

Describe the issue

js partial syntax highlighting

js

js partial syntax highlighting

Are you using highlight or highlightAuto?

no

Sample Code to Reproduce

no error:

  /* svg minify */

  gulp.task('svgMin', function() {
    return gulp.src('source/image/*.svg')
      .pipe(image({svgo: ['--enable', 'cleanupIDs', '--disable', 'convertColors']}))
      .pipe(gulp.dest('source/image'));
  });

error:

  /* svg sprite end inject */

  gulp.task('svgSprite', function() {
    const svgs = gulp.src('source/image/*.svg', {base: 'source/image'})
      .pipe(rename({prefix: 'icon-'}))
      .pipe(svgstore({inlineSvg: true}));

    function fileContents(filePath, file) {
      return file.contents.toString();
    }

    return gulp.src('source/**/*.html')
      .pipe(inject(svgs, {transform: fileContents}))
      .pipe(gulp.dest('source'));
  });

https://drive.google.com/file/d/17vO81oRGZxXrVwKp_Sc0-b4opXsyfUWb/view?usp=sharing

Expected behavior

Problem with any styles

Additional context
problem star with:

    const svgs = gulp.src('source/image/*.svg', {base: 'source/image'})
      .pipe(rename({prefix: 'icon-'}))
      .pipe(svgstore({inlineSvg: true}));
bug help welcome language needs reproduction

All 13 comments

Screen Shot 2020-10-25 at 4 40 05 PM

Can you confirm this on the latest master? I'm seeing no issues.

10.2.0 had a bug that would result in this behavior... so if you're seeing this on StackOverflow or a site using an older version of the library, that's likely what is going on here. Upgrading to the latest version should resolve.

I'm uploading a file from offic site.

I have little experience. I don鈥檛 understand how to compile from sources for github.

https://www.typenote.io/guides/gulp-task-configuration.html

section svg min vs section svg inject

if it doesn't bother you to look at the site using the link and tell me what to do and fix it would be great

@GurovDmitriy Your code is being detected as Bash. Auto-detect is not 100% accurate. For 100% accuracy you need to manually tell us what type of code you are highlighting. You need to manually specify the language in of your code blocks:

<pre class="lang-javascript"><code>...
</code></pre>

when i insert

<pre class = "lang-javascript"> <code> ...
</code> </pre>

or

<pre> <code class = "lang-javascript"> ...
</ code > </pre>
  • no highlighting. now removed the tips, the bash was highlighted. 1 minute updating the site..
    Screenshot_1
    Screenshot_2

In the first picture, the pipe of different blocks is highlighted, but the other does not

Your Highlight.js build does not include Javscript language support: https://www.typenote.io/js/highlight.js Use the default build or create a new build that includes JS support. JS can't be highlighted if you don't build support for it into your library.

I didn鈥檛 find it listed for individually assembling. I thought it was turned on by default. is she on the list ...?

I apologize in advance for the possibly stupid treatment. thanks for your time

I didn鈥檛 find it listed for individually assembling. I thought it was turned on by default. is she on the list ...?

Well now - it's missing, that's incredibly annoying. :-) Fixing.

P.S. If you need a layout, tell me, I'm a beginner web developer. I work for thanks)))

@GurovDmitriy It's back in the list now if you build a new version you should get it.

thank you so much

I set everything up. updated. Working!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

niche4u picture niche4u  路  5Comments

starikovs picture starikovs  路  5Comments

ghost picture ghost  路  3Comments

gskinner picture gskinner  路  4Comments

dlinx picture dlinx  路  5Comments