Remove keys from replacers (#539)

This commit is contained in:
mrdrogdrog 2020-09-05 10:34:43 +02:00 committed by GitHub
parent 63b24fa5bf
commit e58e53a116
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 77 additions and 78 deletions

View file

@ -4,13 +4,13 @@ import { ComponentReplacer } from '../ComponentReplacer'
import { FlowChart } from './flowchart/flowchart'
export class FlowchartReplacer extends ComponentReplacer {
public getReplacement (codeNode: DomElement, index: number): React.ReactElement | undefined {
public getReplacement (codeNode: DomElement): React.ReactElement | undefined {
if (codeNode.name !== 'code' || !codeNode.attribs || !codeNode.attribs['data-highlight-language'] || codeNode.attribs['data-highlight-language'] !== 'flow' || !codeNode.children || !codeNode.children[0]) {
return
}
const code = codeNode.children[0].data as string
return <FlowChart key={`flowchart-${index}`} code={code}/>
return <FlowChart code={code}/>
}
}