Ⅰ. 插件描述
Event-driven HTML5 Parser in JavascriptⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'aredridel/html5'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'aredridel/html5'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'aredridel/html5'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/aredridel/html5
Ⅳ. 文档说明
HTML5 Parser for node.js
Examples
A simple example:
var HTML5 = require('html5');
var jsdom = require('jsdom');
var core = jsdom.browserAugmentation(jsdom.level(3));
var impl = new core.DOMImplementation();
var document = impl.createDocument();
var parser = new HTML5.JSDOMParser(document, core);
parser.parse('<p>I am a very small HTML document</p>');
console.log(document.getElementsByTagName("p")[0].innerHTML);Interesting features
- Streaming parser: You can pass
parser.parseanEventEmitterand the
parser will keep adding data as it's received. - HTML5 parsing algorithm. If you find something this can't parse, I'll want
to know about it. It should make sense out of anything a browser can.
Installation
Use npm, or to use the git checkout, read on.
You'll need to fetch dependencies or initialize git submodules if you're
pulling this from my git repository.
npm install
and give it a run:
npm test
Git repository at http://dinhe.net/~aredridel/projects/js/html5.git/