Skip to content

Options to change the code template #12

Open
@mrbinky3000

Description

@mrbinky3000

Thanks for creating this. It's almost exactly what I was looking for.

How do you pass your own custom template to wrap the rendered tag and the html source?

Activity

javiercf

javiercf commented on Jan 16, 2017

@javiercf
Owner

Can you give me an example of what you want to achieve?

lukaswelinder

lukaswelinder commented on Jan 21, 2017

@lukaswelinder

@javiercf In many situations I find that the demo code needs to be more complicated than the codeblock. It would be nice to have some control over the way the block is handled.

mrbinky3000

mrbinky3000 commented on Jan 23, 2017

@mrbinky3000
Author

Simply allow us to set the template as a string of HTML. Your current template shows us the formatted code, and inserts the rendered Component. It would be nice if those two things could be replaced by placeholders in our template string. For example <div>{{code}}</div><div>{{component}}</div>

mrbinky3000

mrbinky3000 commented on Jan 23, 2017

@mrbinky3000
Author

I'm using handlebars above, but use any method you like.

lukaswelinder

lukaswelinder commented on Jan 24, 2017

@lukaswelinder

@mrbinky3000 I was thinking something more along the lines of convention on the language/render declaration:

// Render component only:
~~~ render
<Component { ...props } />
~~~
// Render with code block:
~~~ render jsx
<Component { ...props } />
~~~

However I do like the idea of being able to decide where the component is rendered:

~~~ render(componentName) jsx
<Component { ...props } />
~~~

... some README stuff
{ componentName.codeblock }
... more README stuff
{ componentName.component }

Or something along those lines...

fernandopasik

fernandopasik commented on May 9, 2017

@fernandopasik
Collaborator

I think if we support a custom template for the code source and executed, we'll need to add an option in the loader that would go into the webpack config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mrbinky3000@fernandopasik@javiercf@lukaswelinder

        Issue actions

          Options to change the code template · Issue #12 · javiercf/react-markdown-loader