Skip to content

Commit 76aa1f0

Browse files
committed
Merge pull request #52 from pc035860/support-prefixed-directives
Support prefixed directives
2 parents 1934b97 + cae7f1b commit 76aa1f0

15 files changed

+374
-342
lines changed

Gruntfile.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ module.exports = function(grunt) {
5252
'}));'
5353
},
5454
build: {
55-
src: '<%= dir.src %>/<%= pkg.name %>.js',
56-
dest: '<%= dir.build %>/<%= pkg.name %>.js'
55+
src: '<%= ngAnnotate.build.dest %>',
56+
dest: '<%= ngAnnotate.build.dest %>'
5757
}
5858
},
5959
uglify: {
@@ -63,7 +63,7 @@ module.exports = function(grunt) {
6363
banner: '<%= meta.banner %>\n'
6464
},
6565
build: {
66-
src: '<%= dir.build %>/<%= pkg.name %>.js',
66+
src: '<%= concat.build.dest %>',
6767
dest: '<%= dir.build %>/<%= pkg.name %>.min.js'
6868
}
6969
},
@@ -93,6 +93,12 @@ module.exports = function(grunt) {
9393
keepalive: true
9494
}
9595
}
96+
},
97+
ngAnnotate: {
98+
build: {
99+
src: '<%= dir.src %>/<%= pkg.name %>.js',
100+
dest: '<%= dir.build %>/<%= pkg.name %>.js'
101+
}
96102
}
97103
});
98104

@@ -102,10 +108,11 @@ module.exports = function(grunt) {
102108
grunt.loadNpmTasks('grunt-contrib-connect');
103109
grunt.loadNpmTasks('grunt-contrib-concat');
104110
grunt.loadNpmTasks('grunt-contrib-copy');
111+
grunt.loadNpmTasks('grunt-ng-annotate');
105112

106113
grunt.registerTask('default', [
107114
'jshint:beforeuglify',
108-
'concat:build', 'uglify:build', 'copy:build'
115+
'ngAnnotate:build', 'concat:build', 'uglify:build', 'copy:build'
109116
]);
110117
};
111118

README.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ Follow the instructions [here](http://softwaremaniacs.org/soft/highlight/en/down
2020
Using a prebuilt version of highlight.js hosted at Yandex here.
2121
```html
2222
<!-- personal preference: github theme -->
23-
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/github.min.css">
24-
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"></script>
23+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/styles/github.min.css">
24+
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/highlight.min.js"></script>
2525
```
2626

2727
Include `angular-highlightjs` module script with AngularJS script on your page.
2828
```html
29-
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
29+
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
3030
<script src="http://pc035860.github.io/angular-highlightjs/angular-highlightjs.min.js"></script>
3131
```
3232

@@ -70,7 +70,7 @@ myApp.config(function (hljsServiceProvider) {
7070
### hljs
7171
This is a required directive. Without any other supportive directives, it provides basic inline highlight function. For better understanding, some notes about using it are specified in the live example page.
7272

73-
The directive automatically escapes its content HTML entities by default. Can be turned off with explicitly configuration `escape="{expression evaled to false}"` or `no-escape`, and **they're only applicable for "just-`hljs`" usage**.
73+
The directive automatically escapes its content HTML entities by default. Can be turned off with explicitly configuration `hljs-escape="{expression evaled to false}"` or `hljs-no-escape`, and **they're only applicable for "just-`hljs`" usage**.
7474

7575
[Live example](http://pc035860.github.io/angular-highlightjs/example/#/hljs)
7676

@@ -82,16 +82,16 @@ The directive automatically escapes its content HTML entities by default. Can be
8282
<!-- hljs end -->
8383

8484
<!-- Will get the same result as above -->
85-
<div hljs no-escape>
85+
<div hljs hljs-no-escape>
8686
&lt;!-- put your codes here --&gt;
8787
</div>
8888
```
8989

90-
#### source (optional)
90+
#### hljs-source (optional)
9191
Type: `expression`
9292
Default: `undefined`
9393

94-
If `source` is presented, the `hljs` directive will evaluate the expression and highlight the result string. This is pretty useful for dynamically changed content.
94+
If `hljs-source` is presented, the `hljs` directive will evaluate the expression and highlight the result string. This is pretty useful for dynamically changed content.
9595

9696
[Live example](http://pc035860.github.io/angular-highlightjs/example/#/hljs-source)
9797

@@ -105,17 +105,17 @@ Dynamically changed content.
105105
<div ng-show="subSource">
106106
<br>
107107
<!-- hljs connected with $scope.subSource -->
108-
<div hljs source="subSource"></div>
108+
<div hljs hljs-source="subSource"></div>
109109
</div>
110110
```
111111

112112
The expression. Beware of single-quotes.
113113
```html
114114
<!-- hljs connected with independent string -->
115-
<div hljs source="'<html><head><body></body></head></html>'"></div>
115+
<div hljs hljs-source="'<html><head><body></body></head></html>'"></div>
116116
```
117117

118-
#### include (optional)
118+
#### hljs-include (optional)
119119
Type: `expression`
120120
Default: `undefined`
121121

@@ -126,16 +126,16 @@ Works as the built-in `ng-include` directive, utilizes `$templateCache` and `$ht
126126
From `text/ng-template` script `localOne`. Beware of single-quotes in the expression.
127127
```html
128128
<!-- load text/ng-template named 'localOne' -->
129-
<div hljs include="'localOne'"></div>
129+
<div hljs hljs-include="'localOne'"></div>
130130
```
131131

132132
From `partials/lang-perl` XHR. Again, beware of single-quotes.
133133
```html
134134
<!-- load "partials/lang-perl" -->
135-
<div hljs include="'partials/lang-perl'"></div>
135+
<div hljs hljs-include="'partials/lang-perl'"></div>
136136
```
137137

138-
#### language (optional)
138+
#### hljs-language (optional)
139139
Type: `string`
140140
Default: `undefined`
141141

@@ -145,25 +145,25 @@ Tells the highlight.js which language syntax should be used to highlight the cod
145145

146146
```html
147147
<!-- PHP codes highlight with language detection -->
148-
<div hljs include="'partials/lang-php'"></div>
148+
<div hljs hljs-include="'partials/lang-php'"></div>
149149

150150
<!-- PHP codes highlight with specified language: perl -->
151-
<div hljs include="'partials/lang-php'" language="perl"></div>
151+
<div hljs hljs-include="'partials/lang-php'" hljs-language="perl"></div>
152152
```
153153

154154

155-
#### compile (optional)
155+
#### hljs-interpolate (optional)
156156
Type: `expression`
157157
Default: `undefined`
158158

159-
Compiles the highlighted code and links it with current scope. The expression will be evaluated after every actual highlight action.
159+
Interpolates the highlighted code and links it with current scope.
160160

161-
The attribute works with all methhods of highlighting: `hljs`, `hljs source` and `hljs include`.
161+
The attribute works with all methods of highlighting: `hljs`, `hljs-source` and `hljs-include`.
162162

163163
[Live example](http://pc035860.github.io/angular-highlightjs/example/#/hljs-compile)
164164

165165
```html
166-
<div hljs include="'compile-me'" compile="true"></div>
166+
<div hljs hljs-include="'interpolate-me'" hljs-interpolate="true"></div>
167167
```
168168

169169
### Happy highlighting!!!

0 commit comments

Comments
 (0)