Fix: video parsing and Markdown export issues#1955
Fix: video parsing and Markdown export issues#1955nperez0111 merged 8 commits intoTypeCellOS:mainfrom
Conversation
|
@Hector-Zhuang is attempting to deploy a commit to the TypeCell Team on Vercel. A member of the Team first needs to authorize it. |
|
@matthewlipski @nperez0111 @YousefED |
Try to maintain or fork a repository of this project. This is what I'm doing. I've been fixing bugs while integrating this with my work |
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/mantine
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
commit: |
packages/core/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.ts
Outdated
Show resolved
Hide resolved
nperez0111
left a comment
There was a problem hiding this comment.
Let's wait for: #1904
|
@iyansr feel free to use the pkg pr new versions that were generated above. They'll include this and some unreleased changes |
@nperez0111 I got this when i install from pkg pr |
|
@iyansr |
@nperez0111 Should I install all with the pkg.pr.new ? |
|
Yep, that should be it @iyansr |
The issue still exist unfortunately 🥲 |
|
You likely have duplicates somewhere, look around for duplicate versions using |
Sure, I will try, thanks for helping 🙏 |
| return parts[parts.length - 1]; | ||
| } | ||
|
|
||
| export function isVideoUrl(url: string) { |
There was a problem hiding this comment.
@nperez0111 how do you feel about checking if a file is a video based on a hard coded list of file endings? The alternative would be to get it from the meta.fileBlockAccept field in the video block's implementation. It would be nice to use this instead of a hard coded list, but I'm wary of what happens if someone replaces the default video block with their own. Wdyt?
There was a problem hiding this comment.
I think hard-coding is fine for now, this is what the markdown parser would've done anyway.
|
Thanks @Hector-Zhuang for this! |


Description:
This PR addresses two issues related to
<video>elements in the editor:Video parsed as an image
Previously,
<video>elements were being processed by the image handler inremarkRehype, causing videos to be treated as images.Video exported as a link in Markdown
When exporting content containing videos to Markdown, the videos were incorrectly serialized as standard link Markdown:
Fixes implemented:
Updated the image handler to detect videos by extension (mp4, webm, etc.) and process them as
<video>elements with the correct attributes: src, data-url, data-name and so on.Added a
convertVideoElementToMarkdownplugin to transform<video>elements into a dedicated video markdown with url and title.#1938