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 ) ; 문제를 추가하거나 버그, 검토 또는 제안에 대한 PR을 열어주세요.
parsers/block-name 에 추가하십시오. 기존 기능을 확인하여 제안 사항을 확인하십시오.pnpm test && pnpm build 통해 모든 테스트가 잘 작동합니다.tests 디렉토리에 테스트를 추가하십시오. 테스트가 적절한 적용 범위로 통과해야합니다. 나는 당신의 의견과 제안을하고 싶습니다. 더 많은 editorjs 블록에 대한 지원이 필요하면 알려줄 수도 있습니다.
도움이되면이 저장소에 별을주는 것이 좋습니다. 당신은 또한 나에게 커피를 살 수 있습니다
MIT 공개 라이센스
@pavittarx