Skip to content

Commit

Permalink
feat: support the new angular "@-syntax"
Browse files Browse the repository at this point in the history
Angular v17 introduces a new syntax that is not compatible anymore with pure HTML.
This PR introduces a new component for the languages "angular" and its alias "ng".
  • Loading branch information
JeanMeche committed Oct 28, 2023
1 parent 59e5a34 commit 0fa5e8c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions components/angular.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(function (Prism) {

Check warning on line 1 in components/angular.js

View workflow job for this annotation

GitHub Actions / lint

Move the invocation into the parens that contain the function
Prism.languages.angular = Prism.languages.extend('markup', {

Check warning on line 2 in components/angular.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 1 tab but found 2 spaces
'keyword': /(?:@if|@for|@switch|@defer|@loading|@error|@placeholder|prefetch)\b/,

Check warning on line 3 in components/angular.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 2 tabs but found 4 spaces
'operator': /\b(?:on|when)\b/,

Check warning on line 4 in components/angular.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 2 tabs but found 4 spaces
'number': {

Check warning on line 5 in components/angular.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 2 tabs but found 4 spaces
pattern: /\b(minimum|after)\s+\d+(?:s|ms|)/gi,

Check warning on line 6 in components/angular.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 3 tabs but found 6 spaces

Check warning on line 6 in components/angular.js

View workflow job for this annotation

GitHub Actions / lint

The alternatives of this group can be sorted without affecting the regex

Check warning on line 6 in components/angular.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected group '(?:s|ms|)'. Use '(?:s|ms)?' instead

Check failure on line 6 in components/angular.js

View workflow job for this annotation

GitHub Actions / lint

No empty alternatives. Use quantifiers instead
lookbehind: true,

Check warning on line 7 in components/angular.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 3 tabs but found 6 spaces
},

Check warning on line 8 in components/angular.js

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 2 tabs but found 4 spaces
'builtin': {pattern: /\b(?:viewport|timer|minimum|after|hover|idle|immediate|interaction)/},
'function':
/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
});

Prism.languages.ng = Prism.languages.angular;
})(Prism);

0 comments on commit 0fa5e8c

Please sign in to comment.