( prismToken: string | Prism.Token, parentType = "plain" )
| 64 | } |
| 65 | |
| 66 | function wrapToken( |
| 67 | prismToken: string | Prism.Token, |
| 68 | parentType = "plain" |
| 69 | ): NestedToken { |
| 70 | if (typeof prismToken === "string") { |
| 71 | return { |
| 72 | type: parentType, |
| 73 | content: prismToken |
| 74 | }; |
| 75 | } |
| 76 | |
| 77 | if (Array.isArray(prismToken.content)) { |
| 78 | return { |
| 79 | type: prismToken.type, |
| 80 | content: tokenizeStrings(prismToken.content, prismToken.type) |
| 81 | }; |
| 82 | } |
| 83 | |
| 84 | return wrapToken(prismToken.content, prismToken.type); |
| 85 | } |
| 86 | |
| 87 | type FlatToken = { |
| 88 | type: string; |
no test coverage detected