hedgedoc/src/components/markdown-renderer/markdown-extension/linemarker/linemarker-replacer.tsx
Tilman Vatteroth 7a9951e351 fix(component replacer): Use symbol for DO_NOT_REPLACE instead of undefined
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2022-10-09 22:51:41 +02:00

19 lines
712 B
TypeScript

/*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { Element } from 'domhandler'
import type { NodeReplacement } from '../../replace-components/component-replacer'
import { ComponentReplacer, DO_NOT_REPLACE } from '../../replace-components/component-replacer'
import { LinemarkerMarkdownExtension } from './linemarker-markdown-extension'
/**
* Detects line markers and suppresses them in the resulting DOM.
*/
export class LinemarkerReplacer extends ComponentReplacer {
public replace(codeNode: Element): NodeReplacement {
return codeNode.name === LinemarkerMarkdownExtension.tagName ? null : DO_NOT_REPLACE
}
}