diff --git a/src/slide.js b/src/slide.js index 304d53f..a45cbe2 100644 --- a/src/slide.js +++ b/src/slide.js @@ -2,7 +2,7 @@ import React from "react"; import animation from "./animation"; import theme from "./nightOwl"; -const themeStylesByType = {}; +const themeStylesByType = Object.create(null); theme.styles.forEach(({ types, style }) => { types.forEach(type => { themeStylesByType[type] = Object.assign( diff --git a/src/tokenizer.js b/src/tokenizer.js index a53aa45..681445b 100644 --- a/src/tokenizer.js +++ b/src/tokenizer.js @@ -19,14 +19,14 @@ function flattenTokens(tokens) { } // Convert strings to tokens -function tokenizeStrings(prismTokens) { +function tokenizeStrings(prismTokens, parentType = "plain") { return prismTokens.map(pt => typeof pt === "string" - ? { type: "plain", content: pt } + ? { type: parentType, content: pt } : { type: pt.type, content: Array.isArray(pt.content) - ? tokenizeStrings(pt.content) + ? tokenizeStrings(pt.content, pt.type) : pt.content } );