Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace code block language overloading with React components #21

Closed
grossbart opened this issue May 19, 2015 · 3 comments
Closed

Replace code block language overloading with React components #21

grossbart opened this issue May 19, 2015 · 3 comments

Comments

@grossbart
Copy link
Contributor

Instead of overloading the code block language parameter with specimen types, change the Markdown renderer to accept React components. With this in place, we can include specimens as JSX React components, clarifying intent and simplifying configuration/extension possibilities.

To help with this endeavor, we might switch to Remarkable as a Markdown renderer. There is the React Remarkable plugin that in theory should support this out of the box:

<Markdown>
  # Catalog example

  > A short introduction

  ## A card

  This card shows a specimen:

  <HtmlSpecimen>
    <button class="button">Button</button>
  </HtmlSpecimen>

  More content follows
</Markdown>
@jstcki
Copy link
Contributor

jstcki commented May 20, 2015

Yes! I like this approach very much.

Although I'm not sure if it's that easy to integrate with Markdown files which are loaded on demand. Normally you would do something like:

fetch('foo.md').then((md) => React.render(<Markdown source={md} />, el);

But this way, only plain Markdown will be parsed. And as far as I know, this won't change anything because React will see the whole Markdown content as one string:

fetch('foo.md').then((md) => React.render(<Markdown>{md}</Markdown>, el);

Edit: To clarify, I mean files which contain Markdown mixed with React components, e.g.

# Foo

Bar

<HtmlSpecimen dark>
  <button>Button</button>
</HtmlSpecimen>

...

@grossbart
Copy link
Contributor Author

Of course, pity …

@jstcki jstcki mentioned this issue May 21, 2015
@jstcki
Copy link
Contributor

jstcki commented Oct 26, 2015

Too difficult at the moment because we'd need to build a custom Markdown parser or extend an existing one.

@jstcki jstcki closed this as completed Oct 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants