@nguyenviet3057/react-native-code-highlighter
Version:
18 lines (17 loc) • 597 B
JavaScript
;
import transform from "css-to-react-native";
const ALLOWED_STYLE_PROPERTIES = {
color: true,
background: true,
backgroundColor: true,
fontWeight: true,
fontStyle: true
};
export const getRNStylesFromHljsStyle = hljsStyle => {
return Object.fromEntries(Object.entries(hljsStyle).map(([className, style]) => [className, cleanStyle(style)]));
};
export const cleanStyle = style => {
const styles = Object.entries(style).filter(([key]) => ALLOWED_STYLE_PROPERTIES[key]).map(([key, value]) => [key, value]);
return transform(styles);
};
//# sourceMappingURL=styles.js.map