Skip to content

Adapt markdown parser in a custom packages #289

@aymericzip

Description

@aymericzip

This component currently uses a forked version of quantizor/markdown-to-jsx.

The original library does not support JSX, so we forked it to add JSX support and improve performance. We want to recommend our own parser by default for users who need JSX.

This parser is actually react focused. the idea would be to extract react dependecies to make this parser cross platform.

Code

https://github.com/aymericzip/intlayer/blob/main/packages/@intlayer/design-system/src/components/MarkDownRender/processor.tsx

Steps to proceed

  1. Extract React-specific dependencies using a callback like createElement: (el => jsx.createElement(el))

  2. Move core parser the processor from packages/@intlayer/design-system/src/components/MarkDownRender/processor.tsx, to packages/@intlayer/core/src to be imported as @intlayer/core.

  3. Create dedicated adaptation for frameworks like:

    • react-intlayer/markdown (for React)
    • vue-intlayer/markdown (for Vue)
    • svelte-intlayer/markdown (for Svelte)(not included in the issue scope)
    • solid-intlayer/markdown (for Solid)(not included in the issue scope)
    • preact-intlayer/markdown (for Preact)(not included in the issue scope)

Requirements

  • All tests must continue to pass.
  • Performance must remain good.

Test

Ensuire the test and build pass, and markdown are correctly rendered on intlayer doc

Doc example: https://intlayer.org/doc/environment/nextjs

Metadata

Metadata

Assignees

Labels

javascriptPull requests that update javascript codereactRelated to react.jsvueRelated to vue js

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions