expensify-common 2.0.171 → 2.0.173
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ExpensiMark.js +6 -0
- package/package.json +1 -1
package/dist/ExpensiMark.js
CHANGED
|
@@ -807,6 +807,9 @@ class ExpensiMark {
|
|
|
807
807
|
* If not provided, all available rules will be applied. If provided, the rules in the array will be skipped.
|
|
808
808
|
*/
|
|
809
809
|
replace(text, { filterRules = [], shouldEscapeText = true, shouldKeepRawInput = false, disabledRules = [], extras = EXTRAS_DEFAULT } = {}) {
|
|
810
|
+
if (!text) {
|
|
811
|
+
return '';
|
|
812
|
+
}
|
|
810
813
|
// This ensures that any html the user puts into the comment field shows as raw html
|
|
811
814
|
let replacedText = shouldEscapeText ? Utils.escapeText(text) : text;
|
|
812
815
|
const rules = this.getHtmlRuleset(filterRules, disabledRules, shouldKeepRawInput);
|
|
@@ -1056,6 +1059,9 @@ class ExpensiMark {
|
|
|
1056
1059
|
* Replaces HTML with markdown
|
|
1057
1060
|
*/
|
|
1058
1061
|
htmlToMarkdown(htmlString, extras = EXTRAS_DEFAULT) {
|
|
1062
|
+
if (!htmlString) {
|
|
1063
|
+
return '';
|
|
1064
|
+
}
|
|
1059
1065
|
let generatedMarkdown = htmlString;
|
|
1060
1066
|
const body = /<(body)(?:"[^"]*"|'[^']*'|[^'"><])*>(?:\n|\r\n)?([\s\S]*?)(?:\n|\r\n)?<\/\1>(?![^<]*(<\/pre>|<\/code>))/im;
|
|
1061
1067
|
const parseBodyTag = generatedMarkdown.match(body);
|