diff --git a/tools/markdown-to-html/docs-marked-renderer.spec.ts b/tools/markdown-to-html/docs-marked-renderer.spec.ts index 139fb5a750aa..8f78b8e125c2 100644 --- a/tools/markdown-to-html/docs-marked-renderer.spec.ts +++ b/tools/markdown-to-html/docs-marked-renderer.spec.ts @@ -49,11 +49,9 @@ describe('DocsMarkdownRenderer', () => { { "example": "exampleName", "file": "example-html.html", - "region": "some-region", + "region": "some-region" } ) -->`); - - // TODO(annieyw): I think DocsMarkedRenderer#html needs to be fixed for the new API? expectEqualIgnoreLeadingWhitespace(result, `
` * turns into @@ -78,20 +78,21 @@ export class DocsMarkdownRenderer extends Renderer { * `
` */ html(html: string) { - html = html.replace(exampleCommentRegex, (_match: string, content: string) => { - if (content.startsWith('{')) { - const {example, file, region} = JSON.parse(content); - return `
`; - } else { - return `
`; - } - } - ); - - return super.html(html); - } + html = html.replace(exampleCommentRegex, (_match: string, content: string) => { + // using [\s\S]* because .* does not match line breaks + if (content.match(/\{[\s\S]*\}/g)) { + const {example, file, region} = JSON.parse(content); + return `
`; + } else { + return `
`; + } + } + ); + + return super.html(html); + } /** * Method that will be called after a markdown file has been transformed to HTML. This method