Fixes: JS error when no heading
Fixes: Reduce hover zone Fixes: Add H1s into TOC
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
// @flow
|
||||
import { escape } from 'lodash';
|
||||
import type { Node } from './types';
|
||||
import slug from 'slug';
|
||||
|
||||
export default function headingToSlug(heading: string, title: string) {
|
||||
const level = heading.replace('heading', 'h');
|
||||
return escape(`${level}-${slug(title)}`);
|
||||
export default function headingToSlug(node: Node) {
|
||||
const level = node.type.replace('heading', 'h');
|
||||
return escape(`${level}-${slug(node.text)}-${node.key}`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user