diff --git a/shared/naturalcrit/markdown.js b/shared/naturalcrit/markdown.js index 98cfa7c8c..78a8a269c 100644 --- a/shared/naturalcrit/markdown.js +++ b/shared/naturalcrit/markdown.js @@ -331,13 +331,13 @@ const processStyleTags = (string)=>{ const id = _.remove(tags, (tag)=>tag.startsWith('#')).map((tag)=>tag.slice(1))[0]; const classes = _.remove(tags, (tag)=>(!tag.includes(':')) && (!tag.includes('='))); - const attributes = _.remove(tags, (tag)=>(!tag.includes(':')) && (!tag.includes('#'))); + const attributes = _.remove(tags, (tag)=>(!tag.includes(':')) && (!tag.includes('#'))).map((attr)=>attr.replace(/="?([^"]*)"?/g, '="$1"'));; const styles = tags.map((tag)=>tag.replace(/:"?([^"]*)"?/g, ':$1;').trim()); return `${classes.join(' ')}" ` + `${id ? `id="${id}"` : ''} ` + `${styles.length ? `style="${styles.join(' ')}"` : ''}` + - `${attributes.length ? attributes.join('') : ''}`; + `${attributes.length ? ` ${attributes.join(' ')}` : ''}`; }; module.exports = { diff --git a/tests/markdown/mustache-syntax.test.js b/tests/markdown/mustache-syntax.test.js index 6669cc6cb..d7323874a 100644 --- a/tests/markdown/mustache-syntax.test.js +++ b/tests/markdown/mustache-syntax.test.js @@ -126,7 +126,7 @@ describe('Inline: When using the Inline syntax {{ }}', ()=>{ }); it('Renders an image with added attributes', function() { - const source = dedent` {position:absolute,bottom:20px,left:130px,width:220px,a=b and c,d=e}`; + const source = dedent` {position:absolute,bottom:20px,left:130px,width:220px,a="b and c",d=e}`; const rendered = Markdown.render(source).trimReturns(); expect(rendered, `Input:\n${source}`, { showPrefix: false }).toBe(`
