diff --git a/packages/app-cli/tests/enex_to_html/quoted-attributes.enex b/packages/app-cli/tests/enex_to_html/quoted-attributes.enex
new file mode 100644
index 000000000..7be1ad101
--- /dev/null
+++ b/packages/app-cli/tests/enex_to_html/quoted-attributes.enex
@@ -0,0 +1,3 @@
+
+ Association Between mRNA Vaccination and COVID-19 Hospitalization and Disease Severity
+
diff --git a/packages/app-cli/tests/enex_to_html/quoted-attributes.html b/packages/app-cli/tests/enex_to_html/quoted-attributes.html
new file mode 100644
index 000000000..2957f4fc5
--- /dev/null
+++ b/packages/app-cli/tests/enex_to_html/quoted-attributes.html
@@ -0,0 +1,3 @@
+
+ Association Between mRNA Vaccination and COVID-19 Hospitalization and Disease Severity
+
\ No newline at end of file
diff --git a/packages/app-cli/tests/html_to_html/anchor_missing_href.dest.html b/packages/app-cli/tests/html_to_html/anchor_missing_href.dest.html
new file mode 100644
index 000000000..0a4898926
--- /dev/null
+++ b/packages/app-cli/tests/html_to_html/anchor_missing_href.dest.html
@@ -0,0 +1 @@
+test
\ No newline at end of file
diff --git a/packages/app-cli/tests/html_to_html/anchor_missing_href.src.html b/packages/app-cli/tests/html_to_html/anchor_missing_href.src.html
new file mode 100644
index 000000000..da987591c
--- /dev/null
+++ b/packages/app-cli/tests/html_to_html/anchor_missing_href.src.html
@@ -0,0 +1 @@
+test
\ No newline at end of file
diff --git a/packages/lib/import-enex-html-gen.test.js b/packages/lib/import-enex-html-gen.test.js
index 348d9df96..93722af11 100644
--- a/packages/lib/import-enex-html-gen.test.js
+++ b/packages/lib/import-enex-html-gen.test.js
@@ -41,6 +41,11 @@ const beautifyHtml = (html) => {
* ``.
*/
const compareOutputToExpected = (options) => {
+ options = {
+ resources: [],
+ ...options,
+ };
+
const inputFile = fileWithPath(`${options.testName}.enex`);
const outputFile = fileWithPath(`${options.testName}.html`);
const testTitle = `should convert from Enex to Html: ${options.testName}`;
@@ -62,12 +67,10 @@ describe('EnexToHtml', function() {
compareOutputToExpected({
testName: 'checklist-list',
- resources: [],
});
compareOutputToExpected({
testName: 'svg',
- resources: [],
});
compareOutputToExpected({
@@ -96,6 +99,10 @@ describe('EnexToHtml', function() {
}],
});
+ compareOutputToExpected({
+ testName: 'quoted-attributes',
+ });
+
// it('fails when not given a matching resource', (async () => {
// // To test the promise-unexpectedly-resolved case, add `audioResource` to the array.
// const resources = [];
diff --git a/packages/lib/resourceUtils.js b/packages/lib/resourceUtils.js
index 51e6cbda3..cab51da61 100644
--- a/packages/lib/resourceUtils.js
+++ b/packages/lib/resourceUtils.js
@@ -39,7 +39,7 @@ const imageMimeTypes = [
'image/vnd.xiff',
];
-const escapeQuotes = (str) => str.replace(/"/g, '"');
+const escapeQuotes = (str) => str.replace(/"/g, '"');
const attributesToStr = (attributes) =>
Object.entries(attributes)
diff --git a/packages/renderer/htmlUtils.ts b/packages/renderer/htmlUtils.ts
index 9a27fb31d..0e24f21be 100644
--- a/packages/renderer/htmlUtils.ts
+++ b/packages/renderer/htmlUtils.ts
@@ -192,6 +192,15 @@ class HtmlUtils {
}
}
+ // For some reason, entire parts of HTML notes don't show up in
+ // the viewer when there's an anchor tag without an "href"
+ // attribute. It doesn't always happen and it seems to depend on
+ // what else is in the note but in any case adding the "href"
+ // fixes it. https://github.com/laurent22/joplin/issues/5687
+ if (name.toLowerCase() === 'a' && !attrs['href']) {
+ attrs['href'] = '#';
+ }
+
let attrHtml = this.attributesHtml(attrs);
if (attrHtml) attrHtml = ` ${attrHtml}`;
const closingSign = this.isSelfClosingTag(name) ? '/>' : '>';