Skip to content

Commit

Permalink
Add support for aliased styles
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Jan 29, 2018
1 parent d192c5e commit f4bb2e7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/magicPenPrism.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module.exports = {

var that = this;
var capitalizedLanguage = upperCamelCase(language);
var languageDefinition = prism.languages[language];

function printTokens(token, parentStyle) {
if (Array.isArray(token)) {
Expand All @@ -98,6 +99,8 @@ module.exports = {
that['prism' + capitalizedLanguage + upperCamelCasedParentStyle](token);
} else if (that['prism' + upperCamelCasedParentStyle]) {
that['prism' + upperCamelCasedParentStyle](token);
} else if (languageDefinition[parentStyle] && languageDefinition[parentStyle].alias) {
printTokens(token, languageDefinition[parentStyle].alias);
} else {
that.text(token);
}
Expand Down

0 comments on commit f4bb2e7

Please sign in to comment.