diff --git a/docs/src/docPages/guide/extend-extensions.md b/docs/src/docPages/guide/extend-extensions.md index 1a91f23e..62124731 100644 --- a/docs/src/docPages/guide/extend-extensions.md +++ b/docs/src/docPages/guide/extend-extensions.md @@ -239,36 +239,36 @@ renderHTML({ HTMLAttributes }) { The `parseHTML()` function tries to load the editor document from HTML. The function gets the HTML DOM element passed as a parameter, and is expected to return an object with attributes and their values. Here is a simplified example from the [`Bold`](/api/marks/bold) mark: ```js - parseHTML() { - return [ - { - tag: 'strong', - }, - ] - }, +parseHTML() { + return [ + { + tag: 'strong', + }, + ] +}, ``` This defines a rule to convert all `` tags to `Bold` marks. But you can get more advanced with this, here is the full example from the extension: ```js - parseHTML() { - return [ - // - { - tag: 'strong', - }, - // - { - tag: 'b', - getAttrs: node => node.style.fontWeight !== 'normal' && null, - }, - // - { - style: 'font-weight', - getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value as string) && null, - }, - ] - }, +parseHTML() { + return [ + // + { + tag: 'strong', + }, + // + { + tag: 'b', + getAttrs: node => node.style.fontWeight !== 'normal' && null, + }, + // + { + style: 'font-weight', + getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value as string) && null, + }, + ] +}, ``` This looks for `` and `` tags, and any HTML tag with an inline style setting the `font-weight` to bold.