@@ -64,7 +64,7 @@ export class DocsMarkdownRenderer extends Renderer {
64
64
* {
65
65
* "example": "exampleName",
66
66
* "file": "example-html.html",
67
- * "region": "some-region",
67
+ * "region": "some-region"
68
68
* }
69
69
* ) -->`
70
70
* turns into
@@ -78,20 +78,21 @@ export class DocsMarkdownRenderer extends Renderer {
78
78
* `<div material-docs-example="name"></div>`
79
79
*/
80
80
html ( html : string ) {
81
- html = html . replace ( exampleCommentRegex , ( _match : string , content : string ) => {
82
- if ( content . startsWith ( '{' ) ) {
83
- const { example, file, region} = JSON . parse ( content ) ;
84
- return `<div material-docs-example="${ example } "
85
- file="${ file } "
86
- region="${ region } "></div>` ;
87
- } else {
88
- return `<div material-docs-example="${ content } "></div>` ;
89
- }
90
- }
91
- ) ;
92
-
93
- return super . html ( html ) ;
94
- }
81
+ html = html . replace ( exampleCommentRegex , ( _match : string , content : string ) => {
82
+ // using [\s\S]* because .* does not match line breaks
83
+ if ( content . match ( / \{ [ \s \S ] * \} / g) ) {
84
+ const { example, file, region} = JSON . parse ( content ) ;
85
+ return `<div material-docs-example="${ example } "
86
+ file="${ file } "
87
+ region="${ region } "></div>` ;
88
+ } else {
89
+ return `<div material-docs-example="${ content } "></div>` ;
90
+ }
91
+ }
92
+ ) ;
93
+
94
+ return super . html ( html ) ;
95
+ }
95
96
96
97
/**
97
98
* Method that will be called after a markdown file has been transformed to HTML. This method
0 commit comments