Skip to content

Commit

Permalink
chore(addon-code): fixing problems with escape
Browse files Browse the repository at this point in the history
  • Loading branch information
planctus committed Jul 6, 2023
1 parent af47f03 commit 657e7b9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/playground/addons/storybook-addon-code/HTMLMarkup.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';

import { decode } from 'html-entities';
import {
SyntaxHighlighter,
Button,
Expand Down Expand Up @@ -38,6 +38,8 @@ function HTMLMarkup({ active, channel }) {
indent_scripts: 'normal',
});

const unescapedCode = decode(beautifiedCode);

return active ? (
<DocumentWrapper>
<TitleBar>
Expand Down Expand Up @@ -68,7 +70,7 @@ function HTMLMarkup({ active, channel }) {
</Button>
</TitleBar>
<StyledSyntaxHighlighter bordered copyable format={false} language="html">
{beautifiedCode}
{unescapedCode}
</StyledSyntaxHighlighter>
</DocumentWrapper>
) : null;
Expand Down
1 change: 1 addition & 0 deletions src/playground/addons/storybook-addon-code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@storybook/addons": "7.0.26",
"@storybook/components": "7.0.26",
"@storybook/theming": "7.0.26",
"html-entities": "2.4.0",
"js-beautify": "1.14.8",
"prop-types": "15.8.1",
"react": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10230,7 +10230,7 @@ html-encoding-sniffer@^3.0.0:
dependencies:
whatwg-encoding "^2.0.0"

html-entities@^2.1.0, html-entities@^2.3.2:
html-entities@2.4.0, html-entities@^2.1.0, html-entities@^2.3.2:
version "2.4.0"
resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.4.0.tgz#edd0cee70402584c8c76cc2c0556db09d1f45061"
integrity sha512-igBTJcNNNhvZFRtm8uA6xMY6xYleeDwn3PeBCkDz7tHttv4F2hsDI2aPgNERWzvRcNYHNT3ymRaQzllmXj4YsQ==
Expand Down

1 comment on commit 657e7b9

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.