(withMarkdown: string)
| 297 | |
| 298 | const markdownRegex = /^\s*(```json)?((.|\n)*?)(```)?\s*$/i; |
| 299 | function maybeStripMarkdown(withMarkdown: string) { |
| 300 | const mdMatch = markdownRegex.exec(withMarkdown); |
| 301 | if (!mdMatch) { |
| 302 | return withMarkdown; |
| 303 | } |
| 304 | return mdMatch[2]; |
| 305 | } |
| 306 | |
| 307 | // For demonstration purposes only. It is recommended to use a proper data |
| 308 | // store in a production application. |