我如何在<code> component

时间:2019-01-18 14:38:32

标签: react-styleguidist

Inside a component. I only see the html for highlight.js hljs as a child prop. How would I get the raw code so I can build a copy code to clipboard button? Thanks.

In styleguide.config.js:

styleguideComponents: {
  Code: path.join(__dirname, "../src/theme/Code")
}

In src/theme/Code.js:

if (isHighlighted) {
    return [
      React.createElement("div", { className: "TEST" }, children),
      React.createElement("code", { className: classNames }, children)
    ];
}

0 个答案:

没有答案