Skip to content

How to add HTML extension #777

@yuer0608

Description

@yuer0608

"@gravity-ui/markdown-editor": "^15.11.0"
In hte doc How to add HTML extension: https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-html-block--docs, The code inside cannot be executed and all errors are reported,please update this doc demo,tell me How to integrate YFM HTML block extension?

For example

// render
const HtmlRenderer = React.forwardRef<HTMLDivElement, HtmlRendererProps>((props, ref) => {
  // ...
  const theme = useThemeType(); // your hook for get theme

  const yfmHtmlBlockConfig = useYfmHtmlBlockStyles();
    () => ({
      theme,
      zoom: {showMenu: true, bindKeys: true, resetOnBlur: true},
    }),
    [theme],
  );

  // ...
  return (
    <div>
      <YfmStaticView
        html={html}
        meta={meta}
        ref={elementRef}
        yfmHtmlBlockConfig={yfmHtmlBlockConfig}
      />
      {props.children}
    </div>
  );
});

() => ({
theme,
zoom: {showMenu: true, bindKeys: true, resetOnBlur: true},
}),
[theme],
);
what this in the react component?

  1. markdown-editor/src/extensions/additional//index.ts
    only export GPT
    export * from './GPT';
    not export yfmHtmlBlock

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions