mirror of
https://github.com/pomber/git-history.git
synced 2024-11-26 08:35:07 +03:00
Fix tag highlighting
This commit is contained in:
parent
f5f28a6f24
commit
e0e4efa12a
@ -2,7 +2,7 @@ import React from "react";
|
|||||||
import animation from "./animation";
|
import animation from "./animation";
|
||||||
import theme from "./nightOwl";
|
import theme from "./nightOwl";
|
||||||
|
|
||||||
const themeStylesByType = {};
|
const themeStylesByType = Object.create(null);
|
||||||
theme.styles.forEach(({ types, style }) => {
|
theme.styles.forEach(({ types, style }) => {
|
||||||
types.forEach(type => {
|
types.forEach(type => {
|
||||||
themeStylesByType[type] = Object.assign(
|
themeStylesByType[type] = Object.assign(
|
||||||
|
@ -19,14 +19,14 @@ function flattenTokens(tokens) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert strings to tokens
|
// Convert strings to tokens
|
||||||
function tokenizeStrings(prismTokens) {
|
function tokenizeStrings(prismTokens, parentType = "plain") {
|
||||||
return prismTokens.map(pt =>
|
return prismTokens.map(pt =>
|
||||||
typeof pt === "string"
|
typeof pt === "string"
|
||||||
? { type: "plain", content: pt }
|
? { type: parentType, content: pt }
|
||||||
: {
|
: {
|
||||||
type: pt.type,
|
type: pt.type,
|
||||||
content: Array.isArray(pt.content)
|
content: Array.isArray(pt.content)
|
||||||
? tokenizeStrings(pt.content)
|
? tokenizeStrings(pt.content, pt.type)
|
||||||
: pt.content
|
: pt.content
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user