2025-07-30 01:05:08 +08:00
import { describe , expect , it } from 'vitest' ;
2025-07-30 00:53:24 +08:00
import { markdownToPlatejs } from './markdown-to-platejs' ;
describe ( 'markdownToPlatejs' , ( ) = > {
it ( 'should convert elaborate markdown to platejs' , async ( ) = > {
const markdown = ` # Welcome to the Plate Playground!
Experience a modern rich - text editor built with [ Slate ] ( https : //slatejs.org) and [React](https://reactjs.org). This playground showcases just a part of Plate's capabilities. [Explore the documentation](/docs) to discover more.
# # Collaborative Editing
Review and refine content seamlessly . Use [ ] ( / d o c s / s u g g e s t i o n ) o r t o . D i s c u s s c h a n g e s u s i n g [ c o m m e n t s ] ( / d o c s / c o m m e n t ) o n m a n y t e x t s e g m e n t s . Y o u c a n e v e n h a v e a n n o t a t i o n s !
# # AI - Powered Editing
Boost your productivity with integrated [ AI SDK ] ( / d o c s / a i ) . P r e s s < k b d > ⌘ + J < / k b d > o r < k b d > S p a c e < / k b d > i n a n e m p t y l i n e t o :
* Generate content ( continue writing , summarize , explain )
* Edit existing text ( improve , fix grammar , change tone )
# # Rich Content Editing
Structure your content with [ headings ] ( / d o c s / h e a d i n g ) , [ l i s t s ] ( / d o c s / l i s t ) , a n d [ q u o t e s ] ( / d o c s / b l o c k q u o t e ) . A p p l y [ m a r k s ] ( / d o c s / b a s i c - m a r k s ) l i k e * * b o l d * * , _ i t a l i c _ , < u > u n d e r l i n e < / u > , ~ ~ s t r i k e t h r o u g h ~ ~ , a n d \ ` c o d e \ ` . U s e [ a u t o f o r m a t t i n g ] ( / d o c s / a u t o f o r m a t ) f o r [ M a r k d o w n ] ( / d o c s / m a r k d o w n ) - l i k e s h o r t c u t s ( e . g . , < k b d > \ \ * < / k b d > f o r l i s t s , < k b d > # < / k b d > f o r H 1 ) .
> Blockquotes are great for highlighting important information .
\ ` \` \` javascript
function hello() {
console . info ( 'Code blocks are supported!' ) ;
}
\ ` \` \`
Create [ links ] ( / d o c s / l i n k ) , [ @ m e n t i o n ] ( / d o c s / m e n t i o n ) u s e r s l i k e [ A l i c e ] ( m e n t i o n : A l i c e ) , o r i n s e r t [ e m o j i s ] ( / d o c s / e m o j i ) ✨ . U s e t h e [ s l a s h c o m m a n d ] ( / d o c s / s l a s h - c o m m a n d ) ( / ) f o r q u i c k a c c e s s t o e l e m e n t s .
# # # How Plate Compares
Plate offers many features out - of - the - box as free , open - source plugins .
| * * Feature * * | * * Plate ( Free & OSS ) * * | * * Tiptap * * |
| -- -- -- -- -- -- -- -- -- - | -- -- -- -- -- -- -- -- -- -- -- | -- -- -- -- -- -- -- -- -- -- - |
| AI | ✅ | Paid Extension |
| Comments | ✅ | Paid Extension |
| Suggestions | ✅ | Paid ( Comments Pro ) |
| Emoji Picker | ✅ | Paid Extension |
| Table of Contents | ✅ | Paid Extension |
| Drag Handle | ✅ | Paid Extension |
| Collaboration ( Yjs ) | ✅ | Hocuspocus ( OSS / Paid ) |
# # # Images and Media
Embed rich media like images directly in your content . Supports [ Media uploads ] ( / d o c s / m e d i a ) a n d [ d r a g & d r o p ] ( / d o c s / d n d ) f o r a s m o o t h e x p e r i e n c e .
! [ ] ( https : //images.unsplash.com/photo-1712688930249-98e1963af7bd?q=80\\&w=600\\&auto=format\\&fit=crop\\&ixlib=rb-4.0.3\\&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)
< file isUpload = "true" name = "sample.pdf" src = "https://s26.q4cdn.com/900411403/files/doc_downloads/test.pdf" / >
< audio src = "https://samplelib.com/lib/preview/mp3/sample-3s.mp3" / >
# # # Table of Contents
< toc / >
Here ' s an unordered list :
* First item with \ ` code snippet \`
* Second item with * * bold text * *
* Third item with _italic text_
* Nested item 1
* Nested item 2 ` ;
const platejs = await markdownToPlatejs ( markdown ) ;
expect ( platejs ) . toBeDefined ( ) ;
} ) ;
} ) ;