Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

604 B
Raw Blame
import { jsxslack } from 'jsx-slack';
import { marked, Renderer } from 'marked';

export const render = markdown => {
  const rendered = marked(markdown, {
    renderer: new (class CustomRenderer extends Renderer {
      heading({ tokens }) {
        return `
          <Fragment>
            <Section><b>${tokens[0].text}</b></Section>
            <Divider />
          </Fragment>`;
      }

      list(token) {
        return `<Section>${super.list(token)}</Section>`;
      }

      hr() {
        return `<Divider />`;
      }
    })(),
  });
  return jsxslack([`<Blocks>${rendered}</Blocks>`]);
};