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

Keep the highlighted handlebars code if there are more plugging, e.g.… #663

Closed
wants to merge 1 commit into from
Closed

Conversation

janvanhelvoort
Copy link

… line-numbers.

@Golmote
Copy link
Contributor

Golmote commented Aug 13, 2015

I'm not sure I understand the issue this PR is supposed to fix... Can you provide an example?

@janvanhelvoort
Copy link
Author

if you have a code block with the following layout, E.g.

<pre class="line-numbers"><code class="language-handlebars">{{template}}</code></pre>

In the 'Line-Number' plugin, on the following lines #40 - #42, the output is set on env.element.

If you use it with handlebars syntax highlight, the added code from the 'Line-Numbers' plugging is removed, because on line #75 - #79 the code is overwritten. It uses env.highlightedCode instead of env.element.

The fix of mine, takes env.element.innerHTML if it is there, otherwise it will take the env.highlightedCode

@Golmote
Copy link
Contributor

Golmote commented Aug 14, 2015

Can you take a look at this Fiddle? It uses the code you just provided with the line numbers plugin. And I can't see any problem.

@janvanhelvoort
Copy link
Author

Strange, in your example, it works, in our project, it isn't working,
Can I mail jou the project?

@janvanhelvoort
Copy link
Author

I see it, on you site: Prism-line-numbers.js rule #1: Prism.hooks.add('complete', function (env) {
If i get it from Bower, rule #1 Prism.hooks.add('after-highlight', function (env) {

but on git, the correct line is displayed ( Prism.hooks.add('complete', function (env) { )
Bower is serving old code?

::Edit

And it uses the wrong git: git://github.com/LeaVerou/prism.git#~1.0.1

$ bower update prism
bower not-cached    git://github.com/LeaVerou/prism.git#~1.0.1
bower resolve       git://github.com/LeaVerou/prism.git#~1.0.1
bower download      https://github.com/LeaVerou/prism/archive/v1.
bower extract       prism#~1.0.1 archive.tar.gz
bower resolved      git://github.com/LeaVerou/prism.git#1.0.1
bower extra-resolution      Unnecessary resolution: angular#1.4.3

@janvanhelvoort
Copy link
Author

$ bower install 'git://github.com/PrismJS/prism#gh-pages' --save works for now 👍

  "dependencies": {
    "prism": "git://github.com/PrismJS/prism#gh-pages"
  },

@Golmote
Copy link
Contributor

Golmote commented Aug 14, 2015

The "complete" hook is a really recent change. It is not part of release 1.0.1.
gh-pages is always the most up-to-date branch, but we're trying to sync master regularly.

@Golmote Golmote closed this Aug 14, 2015
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

Successfully merging this pull request may close these issues.

2 participants