diff options
Diffstat (limited to 'packages/gitbook-plugin-headings/src/index.js')
-rw-r--r-- | packages/gitbook-plugin-headings/src/index.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/packages/gitbook-plugin-headings/src/index.js b/packages/gitbook-plugin-headings/src/index.js new file mode 100644 index 0000000..00bc790 --- /dev/null +++ b/packages/gitbook-plugin-headings/src/index.js @@ -0,0 +1,27 @@ +const GitBook = require('gitbook-core'); +const { React } = GitBook; + +const Heading = React.createClass({ + propTypes: { + children: React.PropTypes.node + }, + + render() { + return ( + <div className="Headings-Container"> + {this.props.children} + </div> + ); + } +}); + +module.exports = GitBook.createPlugin({ + activate: (dispatch, getState, { Components }) => { + // Dispatch initialization actions + dispatch(Components.registerComponent(Heading, { role: 'html:h1' })); + }, + deactivate: (dispatch, getState) => { + // Dispatch cleanup actions + }, + reduce: (state, action) => state +}); |