Skip to content

Markdown component(s) #333

@shawnbot

Description

@shawnbot

It would be nice to have a markdown component to replace our use of the markdown-body class. We might be able to hack this with:

const markdownCSS = sass`@import "primer-markdown/index.scss";`

const Markdown = ({className, ...rest}) => (
  <div className={classnames('markdown-body', className)} {...rest} />
)

export withSystemProps(styled(Markdown)`${markdownCSS}`, COMMON)

Ideally, though, we'd port the CSS over. To support MDX, we could take a slightly different tack:

import {MDXProvider} from '@mdx-js/tag'

const components = {
  a: Link,
  h1: props => <Heading is='h1' fontSize={6} {...props} />,
  // etc.
}

const MarkdownProvider = props => (
  <MDXProvider components={components} {...props} />
)

export withSystemProps(MarkdownProvider, COMMON)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions