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

How do I use these tags for the script template span? #7

Closed
NewPrototype opened this issue Sep 11, 2017 · 9 comments
Closed

How do I use these tags for the script template span? #7

NewPrototype opened this issue Sep 11, 2017 · 9 comments
Labels

Comments

@NewPrototype
Copy link

How do I use these tags for the script template span?

@gluons
Copy link
Owner

gluons commented Sep 11, 2017

Could you give me more information? I don't understand.

@NewPrototype
Copy link
Author

span,script,html tags

@gluons
Copy link
Owner

gluons commented Sep 13, 2017

Did you mean using with HTML code?
If you mean that, you should escape HTML tags before add into slot.

See highlightjs/highlight.js#866

Example:

<highlight-code lang="vue">
&lt;template&gt;
&lt;div id="app"&gt;
&lt;!-- Code Block --&gt;
&lt;highlight-code lang="javascript"&gt;
let str = 'Hello, World!';
console.log(str);
&lt;/highlight-code&gt;
&lt;!-- Inline Code Block --&gt;
&lt;highlight-code lang="javascript" inline&gt;alert('Hello, World!');&lt;/highlight-code&gt;
&lt;/div&gt;
&lt;/template&gt;
&lt;script&gt;
// JavaScript...
&lt;/script&gt;
&lt;style&gt;
/* StyleSheet... */
&lt;/style&gt;
</highlight-code>

@NewPrototype
Copy link
Author

If it's not convenient to do more, I find the latest method, es6 string parsing can be resolved, but the script tag cannot use this method

@gluons
Copy link
Owner

gluons commented Sep 13, 2017

If place HTML tag directly, it will be interpreted as HTML element by browser.
It is constraint. Highlight.js cannot resolve it.

Maybe escape-goat can help you?

@NewPrototype
Copy link
Author

This problem has been resolved and es6 string parsing can be achieved

@gluons
Copy link
Owner

gluons commented Sep 13, 2017

Great. Hope you enjoy using vue-highlight.js. 😉

@NewPrototype
Copy link
Author

Will the

@NewPrototype NewPrototype reopened this Sep 13, 2017
@gluons
Copy link
Owner

gluons commented Sep 13, 2017

the script tag cannot use this method

Did you mean this issue? "Unterminated template literal" syntax error when literal contains script tag

@gluons gluons closed this as completed in db6a444 Nov 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants