editorjs html
Nested List Support
ยูทิลิตี้เพื่อแยกวิเคราะห์ข้อมูลทำความสะอาดเป็น HTML
parseStrict() และ validate() ซ้ำซ้อนจะถูกลบออกเบราว์เซอร์ - get /.build/edjshtml.browser.js
nodejs - get /.build/edjshtml.node.js
สำหรับทั้งเบราว์เซอร์และโหนด - 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 ) ; ดูรุ่น
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 รองรับฟังก์ชั่นการขยายและเอาชนะตัวแยกวิเคราะห์สำหรับบล็อก
// 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 ) ; โปรดเพิ่มปัญหาหรือเปิดประชาสัมพันธ์สำหรับข้อบกพร่องใด ๆ รีวิวหรือข้อเสนอแนะ
parsers/block-name ตรวจสอบฟังก์ชั่นที่มีอยู่สำหรับคำแนะนำpnpm test && pnpm buildtests ตรวจสอบให้แน่ใจว่าการทดสอบของคุณผ่านความคุ้มครองที่เหมาะสม ฉันชอบที่จะมีข้อเสนอแนะและคำแนะนำใด ๆ ของคุณ คุณสามารถแจ้งให้เราทราบได้หากคุณต้องการการสนับสนุนสำหรับบล็อก EditorJs อีกต่อไป
หากคุณพบว่าสิ่งนี้มีประโยชน์ให้พิจารณาให้ดาวที่เก็บนี้เป็นดาว คุณสามารถซื้อกาแฟให้ฉันได้ที่นี่
ใบอนุญาตสาธารณะ MIT
@pavittarx