Skip to content

Styleguidist tries to render code blocks without language tag #641

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

Closed
wkillerud opened this issue Oct 16, 2017 · 3 comments
Closed

Styleguidist tries to render code blocks without language tag #641

wkillerud opened this issue Oct 16, 2017 · 3 comments

Comments

@wkillerud
Copy link
Contributor

Any code block with a language tag of js, jsx or javascript will be rendered as a React component with an interactive playground

From the documentation it looks like only code blocks with the language tab js, jsx, or javascript should render React components. However React Styleguidist even tries to render code blocks without a language tag.

A workaround is to lie and mark the block as a valid but non-JavaScript/JSX language, for instance Java.

A repo which demonstrates the issue and workaround with a component called Dots: https://github.com/wkillerud/example

I would expect code blocks with no language set to be rendered as a code block and not an interactive version.

@sapegin
Copy link
Member

sapegin commented Oct 16, 2017

This is expected behavior for backwards compatibility, usestatic modifier.

@sapegin sapegin closed this as completed Oct 16, 2017
@wkillerud
Copy link
Contributor Author

Allright. Could the documentation perhaps be updated to reflect this then? :) I can update the quoted line and add an entry to the cookbook if you'd like.

@sapegin
Copy link
Member

sapegin commented Oct 16, 2017

We don’t recommend it but I agree it would be nice to mention that it still works ;-)

I think this is the best place for it: https://github.com/styleguidist/react-styleguidist/blob/master/docs/Documenting.md (and it should be mentioned that this is backwards compatible mode, not recommended one).

sapegin pushed a commit that referenced this issue Oct 16, 2017
In issue #641 I was confused that code blocks without language tags were
being rendered as a React component, and not a code documentation block.
It turned out this was for backward compatibility reasons. This commit
updates the documentation to hopefully avoid such confusion in the
future. The docs now also suggest a workaround.
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