Files
outline/app/components/Editor/headingToSlug.js
2017-12-03 11:13:35 -08:00

10 lines
263 B
JavaScript

// @flow
import { escape } from 'lodash';
import { Node } from 'slate';
import slug from 'slug';
export default function headingToSlug(node: Node) {
const level = node.type.replace('heading', 'h');
return escape(`${level}-${slug(node.text)}-${node.key}`);
}