summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-plugin-headings/src/index.js
blob: 00bc790bc2b697ed0805258aa5adcdbd6d194e6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
});