Skip to content

Commit

Permalink
fix(docz-theme-default): add syntax highlight test for typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Sep 28, 2018
1 parent 8252ebf commit f8ff2ac
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ import 'codemirror/addon/fold/xml-fold'
const getLanguage = (children: any) => {
const defaultLanguage = 'jsx'
if (typeof children === 'string') return defaultLanguage

const language = get(children, 'props.props.className') || defaultLanguage
const result = language.replace('language-', '')
return result === 'js' || result === 'javascript' ? 'jsx' : result

if (result === 'js' || result === 'javascript') return 'jsx'
if (result === 'ts' || result === 'tsx' || result === 'typescript') {
return 'text/typescript'
}
return result
}

const getChildren = (children: any) =>
Expand Down

0 comments on commit f8ff2ac

Please sign in to comment.