Skip to content

Commit

Permalink
always unescape html (#255)
Browse files Browse the repository at this point in the history
* always unescape html

enables readability of JSON.stringified attributes

* add changeset
  • Loading branch information
jurajk committed Oct 14, 2021
1 parent 08c1b83 commit b18c753
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/pink-owls-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lighting-beetle/lighter-styleguide': patch
---

Nicer code examples with unescaped HTML attribute values
2 changes: 1 addition & 1 deletion packages/styleguide/src/components/Preview/CodeExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export default class CodeExample extends React.Component {
codeToShow =
typeof children === 'string'
? unescape(children)
: pretty(renderToStaticMarkup(children));
: unescape(pretty(renderToStaticMarkup(children)), { ocd: true });
break;
case 'jsx':
codeToShow = getJSXAsStringFromMarkup(children, codeJSXOptions);
Expand Down

0 comments on commit b18c753

Please sign in to comment.