How to add HTML extension

Đang mở
#777 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tài liệu
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
html, react, typescript
Lĩnh vực
documentation, frontend

Hướng nghiên cứu

Start with the linked HTML-block extension documentation and reproduce its demo using YfmStaticView. Read src/extensions/additional/index.ts to verify whether yfmHtmlBlock is exported, and inspect the shown HtmlRenderer example for the missing useMemo syntax and configuration. Done means the documentation contains an executable example with the correct imports, hook usage, and extension export guidance, and the demo runs without reported errors.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

"@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
Ngôn ngữ chính
TypeScript
Star
428
Fork
48
Merge trung bình
5 ngày 15 giờ
Pull request đã merge (30 ngày)
47

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của gravity-ui/markdown-editor

Tất cả issue của gravity-ui/markdown-editor

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.