editorjs html
Nested List Support
Utilitas untuk parse editorjs membersihkan data ke html.
parseStrict() dan validate() dihapus.Browser - get /.build/edjshtml.browser.js
NodeJS - get /.build/edjshtml.node.js
Untuk browser & node - get /.build/edjshtml.js
npm install editorjs-html const edjsParser = edjsHTML ( ) ;
let html = edjsParser . parse ( editorjs_clean_data ) ;
console . log ( html ) ; const edjsHTML = require ( "editorjs-html" ) ;
const edjsParser = edjsHTML ( ) ;
const html = edjsParser . parse ( editorjs_clean_data ) ;
console . log ( html ) ; Lihat rilis
const edjsParser = edjsHTML ( ) ;
const HTML = edjsParser . parse ( editorjs_data ) ;
// returns array of html strings per block
console . log ( HTML ) ; const edjsParser = edjsHTML ( ) ;
const HTML = edjsParser . parse ( editorjs_data ) ;
// returns an error
if ( HTML instanceof Error ) throw HTML ;
// in case of success, returns an array of strings
console . log ( HTML ) ; const edjsParser = edjsHTML ( ) ;
const blockHTML = edjsParser . parseBlock ( editorjs_data_block ) ;
// returns string of html for this block
console . log ( blockHTML ) ; const edjsParser = edjsHTML ( { } , { strict : true } ) ;
// returns the list of missing parser functions
const blockHTML = edjsParser . parse ( editorjs_data ) ;
console . log ( blockHTML ) ; editorjs-html mendukung memperluas dan mengesampingkan fungsi parser untuk blok.
// Example Custom or Unrecognised Block
{
type : "custom" ,
data : {
text : "Hello World"
}
} // Parse this block in editorjs-html
function customParser ( block ) {
return `<custom-tag> ${ block . data . text } </custom-tag>` ;
}
const plugins = {
// The keyname must match with the type of block you want to parse with this funcion
custom : customParser
// ... add more or overwrite
}
const edjsParser = edjsHTML ( plugins ) ; Harap tambahkan masalah, atau buka PR untuk bug, ulasan, atau saran apa pun.
parsers/block-name . Periksa fungsi yang ada untuk saran.pnpm test && pnpm build .tests . Pastikan tes Anda lulus dengan cakupan yang sesuai. Saya ingin mendapatkan umpan balik dan saran Anda. Anda juga dapat memberi tahu saya, jika Anda memerlukan dukungan untuk blok editorjs lagi.
Jika Anda menemukan ini bermanfaat, pertimbangkan untuk memberi repositori ini bintang. Anda juga dapat membelikan saya kopi di sini
Lisensi Publik MIT
@Pavittarx