editorjs html
Nested List Support
Ein Dienstprogramm zur Analyse von EditorJs Clean -Daten an HTML.
parseStrict() und validate() -Funktionen werden entfernt.Browser - get /.build/edjshtml.browser.js
Nodejs - get /.build/edjshtml.node.js
Für 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 ) ; Siehe Veröffentlichungen
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 unterstützt die Erweiterung und Überschreibung von Parser-Funktionen für Blöcke.
// 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 ) ; Bitte fügen Sie ein Problem hinzu oder öffnen Sie eine PR für Fehler, Überprüfungen oder Vorschläge.
parsers/block-name hinzu. Überprüfen Sie die vorhandenen Funktionen auf Vorschläge.pnpm test && pnpm build .tests hinzu. Stellen Sie sicher, dass Ihre Tests mit entsprechender Deckung bestehen. Ich würde gerne Ihr Feedback und alle Vorschläge haben. Sie können es mich auch wissen lassen, wenn Sie Unterstützung für weitere EditorJS -Blöcke benötigen.
Wenn Sie dies hilfreich finden, sollten Sie diesem Repository einen Stern geben. Sie können mir hier auch einen Kaffee kaufen
MIT Public Lizenz
@pavittarx