From 60393a654c886c1477af4c5d2cf156931215b62f Mon Sep 17 00:00:00 2001 From: William Killerud Date: Mon, 16 Oct 2017 15:40:47 +0200 Subject: [PATCH] Explain behavior for code blocks w/o language tag 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. --- docs/Documenting.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/Documenting.md b/docs/Documenting.md index 143ccb5cb..a46221ef7 100644 --- a/docs/Documenting.md +++ b/docs/Documenting.md @@ -58,7 +58,7 @@ export default class Button extends React.Component { ## Usage examples and Readme files -Styleguidist will look for any `Readme.md` or `ComponentName.md` files in the component’s folder and display them. Any code block with a language tag of `js`, `jsx` or `javascript` will be rendered as a React component with an interactive playground. +Styleguidist will look for any `Readme.md` or `ComponentName.md` files in the component’s folder and display them. Any code block with a language tag of `js`, `jsx` or `javascript` will be rendered as a React component with an interactive playground. For backwards compatibility, code blocks without a language tag are also rendered in this way. It is recommended to always use the proper language tag for new documentation. React component example: @@ -94,6 +94,8 @@ Styleguidist will look for any `Readme.md` or `ComponentName.md` files in the co > **Note:** You can configure examples file name with the [getExampleFilename](Configuration.md#getexamplefilename) option. +> **Note:** If you need to display some JavaScript code in your documentation that you don't want rendered as an interactive playground you can use `static` in place of a language tag + ## External examples using doclet tags Additional example files can be associated with components using `@example` doclet syntax.