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

Stop adding ="" to valueless html attributes #60

Open
chrisfay opened this issue Feb 3, 2016 · 3 comments
Open

Stop adding ="" to valueless html attributes #60

chrisfay opened this issue Feb 3, 2016 · 3 comments

Comments

@chrisfay
Copy link

chrisfay commented Feb 3, 2016

[See this discussion https://github.com/highlightjs/highlight.js/issues/1058]

How do I configure so that this:

<foo bar></foo>

...doesn't become this after it's ran through highlightjs:

<foo bar=""></foo>

screen shot 2016-02-02 at 12 57 39 pm
screen shot 2016-02-02 at 12 57 31 pm

@pc035860
Copy link
Owner

pc035860 commented Feb 3, 2016

Hi, I guess you already got the answer from highlightjs/highlight.js/issues/1058.

What you actually need is preventing your <foo bar></foo> to be parsed by browser before AngularJS gets it hands on it.

hljs source or hljs include can do the trick.

See #30 for the previous discussion.

An example of solving it with hljs-include

<div hljs hljs-include="'the-foo-bar-source'"></div>

<script id="the-foo-bar-source" type="text/ng-template">
<foo bar></foo>
</script>

@chrisfay
Copy link
Author

chrisfay commented Feb 3, 2016

Ahhh, gotcha. I think I was misunderstanding at what stage the attributes
were getting modified before rendering. This makes sense, thanks!

Chris

On Wed, Feb 3, 2016 at 11:26 AM Chih-Hsuan Fan [email protected]
wrote:

Hi, I guess you already got the answer from highlightjs/highlight.js#1058
highlightjs/highlight.js#1058.

What you actually need is preventing your to be parsed by
browser before AngularJS gets it hands on it.

hljs source
http://pc035860.github.io/angular-highlightjs/example/#/hljs-source or hljs
include
http://pc035860.github.io/angular-highlightjs/example/#/hljs-include
can do the trick.

See #30 #30 for
the previous discussion.

An example of solving it with hljs-include

<script id="the-foo-bar-source" type="text/ng-template"> </script>


Reply to this email directly or view it on GitHub
#60 (comment)
.

Chris Fay
http://www.chrisfay.net
[email protected]

@pc035860
Copy link
Owner

pc035860 commented Feb 3, 2016

BTW, you can also prevent from browser parsing by manually escaping those code you put inside hljs directive, and use it with hljs-no-escape option.

For example

<div hljs hljs-no-escape>
&lt;foo bar&gt;&lt;/foo&gt;
</div>

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