This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/app/components/Editor/headingToSlug.js

10 lines
279 B
JavaScript

// @flow
import { escape } from 'lodash';
import type { node } from 'slate-prop-types';
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}`);
}