Skip to content

Commit

Permalink
Fix tag highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
pomber committed Feb 7, 2019
1 parent f5f28a6 commit e0e4efa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/slide.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions src/tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
);
Expand Down

0 comments on commit e0e4efa

Please sign in to comment.