mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-26 01:33:02 +00:00
20 lines
475 B
JavaScript
20 lines
475 B
JavaScript
const React = require('react');
|
|
const toSlug = require('./toSlug.js');
|
|
|
|
const Header = React.createClass({
|
|
render() {
|
|
const slug = toSlug(this.props.toSlug || this.props.children);
|
|
const Heading = 'h' + this.props.level;
|
|
|
|
return (
|
|
<Heading {...this.props}>
|
|
<a className="anchor" name={slug}></a>
|
|
{this.props.children}
|
|
{' '}<a className="hash-link" href={'#' + slug}>#</a>
|
|
</Heading>
|
|
);
|
|
},
|
|
});
|
|
|
|
module.exports = Header;
|