diff --git a/src/core/render/utils.js b/src/core/render/utils.js index 03c9ef145..347614ca7 100644 --- a/src/core/render/utils.js +++ b/src/core/render/utils.js @@ -23,8 +23,8 @@ export function getAndRemoveConfig(str = '') { if (str) { str = str - .replace(/^"(:.*)"$/, '$1') - .replace(/^'(:.*)'$/, '$1') + .replace(/^"(.*)"$/, '$1') + .replace(/^'(.*)'$/, '$1') .replace(/(?:^|\s):([\w-]+:?)=?([\w-%]+)?/g, (m, key, value) => { if (key.indexOf(':') === -1) { config[key] = (value && value.replace(/"/g, '')) || true; diff --git a/test/unit/render-util.test.js b/test/unit/render-util.test.js index 17108766e..6ec34d1b7 100644 --- a/test/unit/render-util.test.js +++ b/test/unit/render-util.test.js @@ -59,13 +59,13 @@ describe('core/render/utils', () => { }); }); - test('dont parse quotes without colon', () => { + test('parse quotes without first colon', () => { const result = getAndRemoveConfig( - `[filename](_media/example.md 'include')` + `[filename](_media/example.md 'include :foo=bar')` ); expect(result).toMatchObject({ - config: {}, + config: { foo: 'bar' }, str: `[filename](_media/example.md 'include')`, }); });