styleguidist/react-styleguidist

Live editing HTML code blocks

Open

#824 aperta il 15 feb 2018

Vedi su GitHub
 (3 commenti) (3 reazioni) (0 assegnatari)TypeScript (1416 fork)github user discovery
help wantedrequest for comments

Metriche repository

Star
 (11.091 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Styleguidist allows you to use JS/JSX code blocks as "playground langs" (eg you get the CodeMirror editor and can edit examples live) and this is great for helping people try something out.

In my case, it'd be ideal to allow live editing of HTML code blocks too to help demonstrate recommendations of markup, classes, layout structure etc that aren't specifically tied to React components.

Has this been considered before? I can (somewhat) workaround the issue by creating fake blocks like this:

```jsx
<div className="wrapper">
  <a className="btn btn-primary">Example</a>
  <img src="img.svg" />
</div>
``‌`

but I have to use React/JSX syntax which deviates from standard HTML in attributes, requires self-closing tags, etc. Likewise, there's the PLAYGROUND_LANGS in chunkify.js but there's more work required to handle treating the codeblock as HTML and not JS/JSX later that I've not gone into yet.

In short, I was curious as to a) whether this'd be considered before and b) if a PR implementing the feature would be useful before I start digging further.

Thanks for such an awesome project.

Guida contributor