fix code highlighting with ...

This commit is contained in:
August Skare
2018-10-30 09:05:52 +01:00
parent 4c8178fc30
commit 6b11ca6c1d
4 changed files with 31 additions and 16 deletions

View File

@@ -18,6 +18,7 @@ interface CodeProps {
gutter?: Array<number>;
gutterLength?: number;
copy?: boolean;
etc?: boolean;
}
interface CodeState {
@@ -134,15 +135,16 @@ class Code extends React.Component<CodeProps, CodeState> {
}
async componentDidMount() {
const { language, children, diff, gutter } = this.props;
const { language, children, diff, gutter, etc } = this.props;
const code = children as string;
if (language !== undefined) {
/* console.log(code); */
const { default: highlight } = await System.import(/* webpackChunkName: 'highlightjs' */ 'ts/highlight');
this.setState({
hlCode: highlight(language, code, diff, gutter),
hlCode: highlight({ language, code, diff, gutter, etc }),
});
}
}
@@ -174,6 +176,8 @@ class Code extends React.Component<CodeProps, CodeState> {
Code = StyledCodeDiff as any;
}
/* console.log(hlCode); */
return (
<Container>
<Base language={language} diff={diff} light={light}>