#Copy Code button doesnt work as expected
8 messages · Page 1 of 1 (latest)
don't use @everyone just be patient and wait for someone to respond
go look at the server rules
#welcome message
Hi @hasty ember ! I am digging into this one right now actually. I have a decorator that wraps my template in some layout related structure that I dont want in the copy code. When i find a solution I will update this thread
One option that I forgot about is to manually enter the docs source code value
parameters: {
docs: {
source: {
code: `<AsyncButton label="AsyncAction" onClick={mockAsyncAction} />`,
language: 'html',
type:'auto',
format: true
}
}
}
Another option is using the transformSource option in docs config to programmatically transform the source.
transformSource: (source, storyContext) => {
//regular expression to unwrapp the outer div
const regexRes = source.match(/<div class="unwrap-me">([\s\S]*?)<\/div>$/);
return dedent(regexRes ? regexRes[1] : source);
}
Thanks, I found another workaround