debian-mirror-gitlab/app/assets/javascripts/behaviors/markdown/serializer.js

25 lines
566 B
JavaScript
Raw Normal View History

2022-04-04 11:22:00 +05:30
import { MarkdownSerializer } from '~/lib/prosemirror_markdown_serializer';
2019-03-02 22:35:43 +05:30
import editorExtensions from './editor_extensions';
const nodes = editorExtensions
2021-03-08 18:12:59 +05:30
.filter((extension) => extension.type === 'node')
2019-03-02 22:35:43 +05:30
.reduce(
(ns, { name, toMarkdown }) => ({
...ns,
[name]: toMarkdown,
}),
{},
);
const marks = editorExtensions
2021-03-08 18:12:59 +05:30
.filter((extension) => extension.type === 'mark')
2019-03-02 22:35:43 +05:30
.reduce(
(ms, { name, toMarkdown }) => ({
...ms,
[name]: toMarkdown,
}),
{},
);
export default new MarkdownSerializer(nodes, marks);