Comparing version 0.5.0 to 0.5.1
import React from 'react'; | ||
import { Theme, Lang } from '@code-hike/lighter'; | ||
type MdCodeText = { | ||
type: "code"; | ||
props: { | ||
className: string; | ||
children: string; | ||
}; | ||
}; | ||
type CodeText = string | MdCodeText; | ||
type DoubleTheme = { | ||
@@ -12,3 +21,3 @@ dark: Theme; | ||
lang: Lang; | ||
children: string; | ||
children: CodeText; | ||
style?: React.CSSProperties; | ||
@@ -15,0 +24,0 @@ className?: string; |
@@ -75,2 +75,11 @@ "use strict"; | ||
}) { | ||
var _a, _b; | ||
let language = lang; | ||
let text; | ||
if (typeof code === "object") { | ||
text = (_a = code.props) == null ? void 0 : _a.children; | ||
language = (_b = code.props) == null ? void 0 : _b.className.replace("language-", ""); | ||
} else { | ||
text = code; | ||
} | ||
const { | ||
@@ -83,3 +92,3 @@ lines, | ||
lineNumberForeground | ||
} = yield (0, import_lighter.highlight)(code, lang, theme); | ||
} = yield (0, import_lighter.highlight)(text.trim(), language, theme); | ||
const lineCount = lines.length; | ||
@@ -118,3 +127,4 @@ const digits = lineCount.toString().length; | ||
borderRadius: "4px", | ||
colorScheme | ||
colorScheme, | ||
overflow: "auto" | ||
}, style), | ||
@@ -121,0 +131,0 @@ children: [ |
{ | ||
"name": "bright", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/index.mjs", |
Sorry, the diff of this file is not supported yet
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
13238
449