【文件属性】:
文件名称:hast-util-to-dom:将hast转换为DOM树的实用程序
文件大小:21KB
文件格式:ZIP
更新时间:2021-05-12 12:41:25
html dom syntax-tree util unist
急速使用
实用程序可转换为DOM树。
安装
该软件包 :需要使用Node 12+才能使用它,并且必须将其import而不是require d。
:
npm install hast-util-to-dom
用
该实用程序仅供浏览器使用!
import { toDom } from 'hast-util-to-dom' ;
const el = toDom ( {
type : 'element' ,
tagName : 'h1' ,
properties : { } ,
children : [ { type : 'text' , value : 'World!' } ]
} ) ;
console . log ( el ) ;
这将创建一个DOM节点,如下所示:
< h1> World! h1>
如果您想要一个HTML字符串,则有以下几种选择:
/
【文件预览】:
hast-util-to-dom-main
----.gitignore(57B)
----package.json(2KB)
----.npmrc(19B)
----index.js(101B)
----tsconfig.json(362B)
----.github()
--------workflows()
----.prettierignore(22B)
----license(765B)
----lib()
--------index.js(6KB)
----readme.md(4KB)
----test()
--------index.js(10KB)
--------fixtures()
----.editorconfig(147B)