andreypopp / reactdown

Markdown based live document format
https://andreypopp.github.io/reactdown
MIT License
116 stars 10 forks source link

Inline React components? #25

Open SachaG opened 8 years ago

SachaG commented 8 years ago

Would there be a way to support inline components? i.e. something like:

Markdown:

You can --MyComponent text="click"-- me

React:

MyComponent = (props) => <button onClick="....">{props.text}</button>

Result:

You can <button onClick="....">click</button> me
andreypopp commented 8 years ago

There is support for roles modeled after ReStructuredText. ':gh-issue:1234' sans the back ticks. Sorry it is undocumented yet. On Sat, 17 Sep 2016 at 04:25, Sacha Greif notifications@github.com wrote:

Would there be a way to support inline components? i.e. something like:

Markdown:

You can --MyComponent text="click"-- me

React:

MyComponent = (props) =>

Result:

You can me

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/andreypopp/reactdown/issues/25, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB3gnhYIM6w7aN38r9M5o71CIjna6tOks5qq0GggaJpZM4J_eOH .

SachaG commented 8 years ago

If you can point me in the right direction maybe I can contribute to the docs?

andreypopp commented 8 years ago

The problem is that it is now scattered across the parser and the renderer.

That's the type of react down config: https://github.com/andreypopp/reactdown/blob/master/src/Config.js#L57

It says that to use roles you need:

roles: {
  rolename: {component: 'moduleWithTheComponentToRenderRole'}
}

Schema for roles isn't supported yet but I plan to implement that, so that gh:1234 would parse 1234 as a number.

Overall reactdown needs to be simplified a lot, I overengineered it... It might be that you just need to take these modules:

And build with them directly.

I'm not saying I'm not going to work on reactdown — I want to refactor it. First steps would be to upgrade to using Jest for testing (my custom compile-compare-with-fixture schema doesn't scale and could be replaced with Jest snapshots) and upgrade flow version so a lot less type hacks needed.

SachaG commented 8 years ago

Sounds good. I don't know if I can help with the code but I could certainly help with the docs once I figure it out :)

andreypopp commented 8 years ago

Updated tests & flow already. :-) Working on docs