Closed cichelero closed 6 years ago
I found the same behavior on object knob props on alpha.16
Is there a workaround for this?
Knobs are using https://github.com/component/escape-html package to escapes ", ', &, <, and >.
To prevent escaping you can use it like this:
storiesOf(...)
.add('name', () => {}, {
knobs: {
escapeHTML: false
}
})
This can be applied globally by passing it to the decorator setup.
addDecorator(
withKnobs({
escapeHTML: false,
})
);
Using 4.1.11 across the board, only @igor-dv 's answer worked:
storiesOf(...)
.add('name', () => {}, {
knobs: {
escapeHTML: false
}
})
This is in a Vue project where the knobs are being included directly in the components. It would be cleaner if escapeHtml was an option on text knobs - this way the logic will reside with the knob in the component. Please consider exposing this option.
fwiw, with the new exported story format, it goes under parameters
:
export default {
title: 'Base Component',
component: { BaseComponent },
decorators: [withKnobs],
parameters: {
knobs: {
escapeHTML: false,
},
},
}
I found adding the following to .storybook/preview.js
gave me back the functionality of https://github.com/storybookjs/storybook/issues/4445#issuecomment-434775097 after upgrading to 6.x from 5.x
const parameters = {
knobs: {
escapeHTML: false,
},
};
Bug or support request summary
With storybook and knobs release candidate 4, I have the ' string misformated as in the image.
Steps to reproduce
Configure a text knob with text like
You're great!
, it will be displayed asYou're great!
.Minimal repository reproducing the bug
Please specify which version of Storybook and optionally any affected addons that you're running
Affected platforms
Saw it on Chrome and Firefox
Screenshots / Screencast / Code Snippets (Optional)