We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 276be2b commit c0c2efdCopy full SHA for c0c2efd
1 file changed
lib/ExpensiMark.ts
@@ -1237,6 +1237,10 @@ export default class ExpensiMark {
1237
* Replaces HTML with markdown
1238
*/
1239
htmlToMarkdown(htmlString: string, extras: Extras = EXTRAS_DEFAULT): string {
1240
+ if (!htmlString) {
1241
+ return '';
1242
+ }
1243
+
1244
let generatedMarkdown = htmlString;
1245
const body = /<(body)(?:"[^"]*"|'[^']*'|[^'"><])*>(?:\n|\r\n)?([\s\S]*?)(?:\n|\r\n)?<\/\1>(?![^<]*(<\/pre>|<\/code>))/im;
1246
const parseBodyTag = generatedMarkdown.match(body);
0 commit comments