Skip to content

Commit

Permalink
Markup: Added alias for named entities (#2351)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed May 18, 2020
1 parent fdbc447 commit ab1e34a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
8 changes: 7 additions & 1 deletion components/prism-markup.js
Expand Up @@ -39,7 +39,13 @@ Prism.languages.markup = {

}
},
'entity': /&#?[\da-z]{1,8};/i
'entity': [
{
pattern: /&[\da-z]{1,8};/i,
alias: 'named-entity'
},
/&#x?[\da-f]{1,8};/i
]
};

Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
Expand Down
2 changes: 1 addition & 1 deletion components/prism-markup.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion prism.js
Expand Up @@ -775,7 +775,13 @@ Prism.languages.markup = {

}
},
'entity': /&#?[\da-z]{1,8};/i
'entity': [
{
pattern: /&[\da-z]{1,8};/i,
alias: 'named-entity'
},
/&#x?[\da-f]{1,8};/i
]
};

Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
Expand Down
8 changes: 5 additions & 3 deletions tests/languages/markup/entity_feature.js
@@ -1,4 +1,6 @@
module.exports = {
'&amp;': '<span class="token entity" title="&amp;">&amp;amp;</span>',
'&thetasym;': '<span class="token entity" title="&thetasym;">&amp;thetasym;</span>'
};
'&amp;': '<span class="token entity named-entity" title="&amp;">&amp;amp;</span>',
'&thetasym;': '<span class="token entity named-entity" title="&thetasym;">&amp;thetasym;</span>',
'&#65;': '<span class="token entity" title="&#65;">&amp;#65;</span>',
'&#x41;': '<span class="token entity" title="&#x41;">&amp;#x41;</span>'
};

0 comments on commit ab1e34a

Please sign in to comment.