pc035860 / angular-highlightjs

AngularJS directive for syntax highlighting with highlight.js
http://pc035860.github.io/angular-highlightjs/example/
MIT License
294 stars 53 forks source link

Show a html page #27

Closed whisher closed 10 years ago

whisher commented 10 years ago

Hi, sorry to bother you. Is there a way to use your nice module with a html page ?

like:

<!DOCTYPE html>
<html ng-app>
    <head>
        <title>Simple app</title>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"</script>
    </head>
    <body>
        <input ng-model="name" type="text" placeholder="Your name">
        <h1>Hello {{ name }}</h1>
    </body>
</html>

now if I do

<div hljs>
<!DOCTYPE html>
<html ng-app>
    <head>
        <title>Simple app</title>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"</script>
    </head>
    <body>
        <input ng-model="name" type="text" placeholder="Your name">
        <h1>Hello {{ name }}</h1>
    </body>
</html>
</div>

I get

<title>Simple app</title>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js" <="" script="">
    </head>
    <body>
        <input ng-model="name" type="text" placeholder="Your name">
        <h1>Hello {{ name }}</h1>
    </body>
</html>
</div></script>

:(

pc035860 commented 10 years ago

Hi @whisher ,

You may choose to use either source directive or include directive to achieve what you want.

hljs + source

<div hljs source="myHTMLSource"></div>

http://pc035860.github.io/angular-highlightjs/example/#/hljs-source

hljs + include

<div hljs include="'path-to-the-file.html'"></div>

http://pc035860.github.io/angular-highlightjs/example/#/hljs-include

whisher commented 10 years ago

Hi Chih-Hsuan, thanks it works great.

Bye

On 20 July 2014 11:39, Chih-Hsuan Fan notifications@github.com wrote:

Hi @whisher https://github.com/whisher ,

You may choose to use either source directive or include directive to achieve what you want. hljs + source

http://pc035860.github.io/angular-highlightjs/example/#/hljs-source hljs + include

http://pc035860.github.io/angular-highlightjs/example/#/hljs-include

— Reply to this email directly or view it on GitHub https://github.com/pc035860/angular-highlightjs/issues/27#issuecomment-49541831 .