Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linktype: story is lost when converting html to richtext object #25

Open
pa-bru opened this issue Apr 24, 2024 · 0 comments
Open

linktype: story is lost when converting html to richtext object #25

pa-bru opened this issue Apr 24, 2024 · 0 comments

Comments

@pa-bru
Copy link

pa-bru commented Apr 24, 2024

When converting html to markdown and then richtext I loose the linktype: story attributes which causes to load always the english url instead of the translated link in storyblok


Expected Behavior

{
  "type": "link",
  "attrs": {
    "href": "/global/background-remover-tool",
    "uuid": "b0345ad8-a6f6-4f2c-9340-a471cb672ff4",
    "anchor": null,
    "custom": {},
    "target": "_self",
    "linktype": "story"
  }
}

Current Behavior

{
          "text": "remplacement du fond",
          "type": "text",
          "marks": [
            {
              "type": "link",
              "attrs": {
                "href": "/global/background-remover-tool",
                "title": null
              }
            }
          ]
        },

Steps to Reproduce

  1. use an html string as input. it needs to contain a storyblok link (link to a story) inside
    example:
<p>The AI Expand feature of Photoroom is included in the Pro plan. Please refer to our <a href="/pricing" uuid="55f29fb5-9fd7-4cf3-81a2-29c3697f87a1" target="_self" linktype="story">pricing page</a> for a detailed overview of what is included with Photoroom Pro and how much you can save with our annual plan.</p>
  1. then call
const markdownTranslation = turndownService.turndown(htmlString);
const richText = markdownToRichtext(markdownTranslation);
  1. the result doesn't give the story link as expected

Assumption

When the html is converted to markdown with Turndown it looses the story link attributes.
E.g of a storyblok link converted to markdown: [remplacement du fond](/global/background-remover-tool)

Is there a way to keep the storyblok data when converting an html string to a richtext content?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant