From f4bb2e7a6a19ca5f7790d0bf634467ebc5827922 Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Mon, 29 Jan 2018 21:03:52 +0100 Subject: [PATCH] Add support for aliased styles --- lib/magicPenPrism.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/magicPenPrism.js b/lib/magicPenPrism.js index 8b4d9b4..487e992 100644 --- a/lib/magicPenPrism.js +++ b/lib/magicPenPrism.js @@ -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)) { @@ -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); }