Skip to content

[Request] highlighter bodyRender need a flag for finished #372

@Yueyanc

Description

@Yueyanc

🥰 需求描述 | Feature Description

  const componentProps: MarkdownProps['componentProps'] = useMemo(() => {
    return {
      highlight: {
        bodyRender(props) {
          const { language, content } = props
          console.log(content)

          switch (language) {
            case 'echarts':
              return (
                <ErrorBoundary fallbackRender={() => <div className="text-red-500 text-sm px-4 py-10">Unable to display chart</div>}>
                  <MarkdownEcharts content={content} />
                </ErrorBoundary>
              )
            default:
              return props.originalNode
          }
        },
      },
    }
  }, [])

需要一个标识来表示当前tag是否已经完全输出

🧐 解决方案 | Proposed Solution

  const componentProps: MarkdownProps['componentProps'] = useMemo(() => {
    return {
      highlight: {
        bodyRender(props) {
          const { language, content, finished } = props
          console.log(content)

          switch (language) {
            case 'echarts':
              return (
                <ErrorBoundary fallbackRender={() => <div className="text-red-500 text-sm px-4 py-10">Unable to display chart</div>}>
                  <MarkdownEcharts content={content} finished={finished} />
                </ErrorBoundary>
              )
            default:
              return props.originalNode
          }
        },
      },
    }
  }, [])

📝 补充信息 | Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    InactiveNo response in 30 days | 超过 30 天未活跃🌠 Feature RequestNew feature or request | 特性与建议

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions