// @flow
import React, { type Element, createElement } from 'react';
import marksy from 'marksy';
import { Head1, Head2, Head3, Head4, Head5, Text, Link, Span } from '../src';

type ContainerProps = {
  children: string | Element<*>,
};
export const compileMarkdown = marksy({
  createElement,
  elements: {
    h1: Head1,
    h2: Head2,
    h3: Head3,
    h4: Head4,
    h5: Head5,
    p: Text,
    a: Link,
    strong: ({ children }: ContainerProps) => <Span bold>{children}</Span>,
    em: ({ children }: ContainerProps) => <Span italic>{children}</Span>,
  },
});
