Comparing version 0.0.6 to 0.1.0
import { TLang } from 'shiki-languages'; | ||
import { IThemedToken } from './themedTokenizer'; | ||
import { TTheme } from 'shiki-themes'; | ||
import { TTheme, IShikiTheme } from 'shiki-themes'; | ||
export interface HighlighterOptions { | ||
theme: TTheme; | ||
theme: TTheme | IShikiTheme; | ||
langs?: TLang[]; | ||
@@ -7,0 +7,0 @@ } |
@@ -51,3 +51,11 @@ "use strict"; | ||
case 0: | ||
t = shiki_themes_1.getTheme(options.theme); | ||
if (typeof options.theme === 'string') { | ||
t = shiki_themes_1.getTheme(options.theme); | ||
} | ||
else if (options.theme.name) { | ||
t = options.theme; | ||
} | ||
{ | ||
t = shiki_themes_1.getTheme('nord'); | ||
} | ||
langs = shiki_languages_1.commonLangIds.concat(shiki_languages_1.commonLangAliases); | ||
@@ -54,0 +62,0 @@ if (options.langs) { |
@@ -6,2 +6,2 @@ import { IThemedToken } from "./themedTokenizer"; | ||
} | ||
export declare function renderToHtml(lines: IThemedToken[][], options: HtmlRendererOptions): string; | ||
export declare function renderToHtml(lines: IThemedToken[][], options?: HtmlRendererOptions): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function renderToHtml(lines, options) { | ||
if (options === void 0) { options = {}; } | ||
var bg = options.bg || '#fff'; | ||
@@ -5,0 +6,0 @@ var html = ''; |
{ | ||
"name": "shiki", | ||
"version": "0.0.6", | ||
"version": "0.1.0", | ||
"description": "shiki", | ||
@@ -21,7 +21,7 @@ "keywords": [ | ||
"onigasm": "^2.2.1", | ||
"shiki-languages": "^0.0.6", | ||
"shiki-themes": "^0.0.6", | ||
"shiki-languages": "^0.1.0", | ||
"shiki-themes": "^0.1.0", | ||
"vscode-textmate": "https://github.com/octref/vscode-textmate" | ||
}, | ||
"gitHead": "6c638d9958e7d4031ee9bb29bf4f1cb027725eba" | ||
"gitHead": "35e2ea87154bb333789bb24f52cd65fc9cc15ce9" | ||
} |
@@ -13,3 +13,3 @@ import { Registry, IRawTheme } from 'vscode-textmate' | ||
export interface HighlighterOptions { | ||
theme: TTheme | ||
theme: TTheme | IShikiTheme | ||
langs?: TLang[] | ||
@@ -19,3 +19,10 @@ } | ||
export async function getHighlighter(options: HighlighterOptions) { | ||
const t = getTheme(options.theme) | ||
let t: IShikiTheme; | ||
if (typeof options.theme === 'string') { | ||
t = getTheme(options.theme) | ||
} else if (options.theme.name) { | ||
t = options.theme | ||
} { | ||
t = getTheme('nord') | ||
} | ||
@@ -22,0 +29,0 @@ let langs: TLang[] = [ |
@@ -8,3 +8,3 @@ import { IThemedToken } from "./themedTokenizer"; | ||
export function renderToHtml(lines: IThemedToken[][], options: HtmlRendererOptions) { | ||
export function renderToHtml(lines: IThemedToken[][], options: HtmlRendererOptions = {}) { | ||
const bg = options.bg || '#fff' | ||
@@ -11,0 +11,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42705
1091
+ Addedjson5@2.2.3(transitive)
+ Addedshiki-languages@0.1.6(transitive)
+ Addedshiki-themes@0.1.7(transitive)
- Removedshiki-languages@0.0.6(transitive)
- Removedshiki-themes@0.0.6(transitive)
Updatedshiki-languages@^0.1.0
Updatedshiki-themes@^0.1.0