JamesNZL / notion-assignment-import

A free cross-browser extension to load Canvas assignments into Notion, with 8200+ unique users.
https://jamesnzl.xyz/notion-assignment-import
Other
35 stars 5 forks source link

Canvas descriptions sometimes break Notion #344

Open JamesNZL opened 5 months ago

JamesNZL commented 5 months ago

Seems that there are occasionally URL validation errors.

Seems to be when the Canvas assignment contains custom HTML markup, which doesn't get parsed out correctly?

or potentially when there is an href to an anchor object href="#someAnchor"?

JamesNZL commented 5 months ago

Some (redacted where possible) troublesome data:

{
    "available": "Redacted",
    "course": "Redacted",
    "description": "<p><span style=\"font-size: 12pt;\"><a id=\"top\"></a></span></p>\n<div class=\"no-print\">\n<h2 id=\"Navigation\" style=\"margin: 15px 0 15px 0; border-bottom: 5px solid #000000; width: 100%; height: 40px; text-align: center; line-height: 150%; font-size: x-large; background-color: #202020; color: #ffffff;\">In this assignment</h2>\n<div id=\"Navigation_Container\" style=\"padding: 0px 10px 10px 10px; text-align: center;\"><span style=\"font-size: 12pt;\"><a id=\"Purpose_button\" style=\"width: 135px; margin: 5px 5px 0px 0px; background: #f0f0f0; color: #000000; border: 1px solid #b0b0b0; display: inline-block; position: relative; padding: 8px 14px; line-height: 20px; text-align: center; vertical-align: middle; cursor: pointer; text-decoration: none; overflow: hidden;\" href=\"#Purpose\">Assignment Purpose</a>&nbsp;<a id=\"Instructions_button\" style=\"width: 125px; margin: 5px 5px 0px 0px; background: #f0f0f0; color: #000000; border: 1px solid #b0b0b0; display: inline-block; position: relative; padding: 8px 14px; line-height: 20px; text-align: center; vertical-align: middle; cursor: pointer; text-decoration: none; overflow: hidden;\" href=\"#Instructions\">Outline Instructions</a> <a id=\"Grades_button\" style=\"width: 125px; margin: 5px 5px 0px 0px; background: #f0f0f0; color: #000000; border: 1px solid #b0b0b0; display: inline-block; position: relative; padding: 8px 14px; line-height: 20px; text-align: center; vertical-align: middle; cursor: pointer; text-decoration: none; overflow: hidden;\" href=\"#Grades\">Grading Criteria</a> <a id=\"Jump_button\" style=\"width: 125px; margin: 5px 5px 0px 0px; background: #f0f0f0; color: #000000; border: 1px solid #b0b0b0; display: inline-block; position: relative; padding: 8px 14px; line-height: 20px; text-align: center; vertical-align: middle; cursor: pointer; text-decoration: none; overflow: hidden;\" href=\"#Bottom\">Jump to Post Reply</a></span></div>\n</div>\n<h2 id=\"Purpose\" style=\"margin: 15px 0 15px 0; border-bottom: 5px solid #000000; width: 100%; height: 40px; text-align: center; line-height: 150%; font-size: x-large; background-color: #202020; color: #ffffff;\">Purpose</h2>\n<div id=\"Purpose_Container&quot;\" style=\"padding: 0px 10px 10px 10px; border: solid #b0b0b0 1px; overflow: hidden;\">\n<p>Redacted</p>\n<ul>\n<li>redacted</li>\n<li>redacted</li>\n</ul>\n<hr>\n<div style=\"width: 100%; text-align: left;\">Redacted:</div>\n<ul style=\"list-style-type: disc;\">\n<li style=\"width: 100%; text-align: left;\">Redacted.</li>\n<li style=\"width: 100%; text-align: left;\">Redacted.</li>\n<li style=\"width: 100%; text-align: left;\">Redacted.</li>\n<li style=\"width: 100%; text-align: left;\">Redacted.</li>\n<li style=\"width: 100%; text-align: left;\">Redacted.</li>\n<li style=\"width: 100%; text-align: left;\">Redacted.</li>\n<li style=\"width: 100%; text-align: left;\">Redacted.</li>\n<li style=\"width: 100%; text-align: left;\">Redacted.</li>\n<li style=\"width: 100%; text-align: left;\">Redacted.</li>\n<li style=\"width: 100%; text-align: left;\">Redacted.</li>\n</ul>\n<div style=\"width: 100%; text-align: right;\"><a href=\"#top\">Return to top</a></div>\n</div>\n<h2 id=\"Instructions\" style=\"margin: 15px 0 15px 0; border-bottom: 5px solid #000000; width: 100%; height: 40px; text-align: center; line-height: 150%; font-size: x-large; background-color: #202020; color: #ffffff;\">Instructions</h2>\n<div id=\"Instructions_Container\" style=\"padding: 0px 10px 10px 10px; border: solid #b0b0b0 1px; overflow: hidden;\">\n<p>Redacted <a title=\"Redacted [video]\" href=\"https://redacted.instructure.com/courses/2465103/assignments/33132859?wrap=1\">Redacted [video]</a> redacted.</p>\n<hr>\n<p>Redacted <a title=\"Redacted d7a022c\" href=\"https://redacted.instructure.com/courses/2465103/assignments/33132856\" data-api-endpoint=\"https://redacted.instructure.com/api/v1/courses/2465103/assignments/33132856\" data-api-returntype=\"Assignment\">d7a022c</a>. Redacted:</p>\n<ul>\n<li>Redacted.</li>\n<li>Redacted <a title=\"Redacted c7cb8cd\" href=\"https://redacted.instructure.com/courses/2465103/pages/c7cb8cd\" data-api-endpoint=\"https://redacted.instructure.com/api/v1/courses/2465103/pages/c7cb8cd\" data-api-returntype=\"Page\">redacted</a> and <a title=\"Redacted ceea2a8\" href=\"https://redacted.instructure.com/courses/2465103/pages/ceea2a8\" data-api-endpoint=\"https://redacted.instructure.com/api/v1/courses/2465103/pages/ceea2a8\" data-api-returntype=\"Page\">redacted</a> redacted.<strong><br></strong>\n</li>\n<li>\n<span style=\"font-size: 12pt;\">Redacted <a title=\"Redacted 5383d9c\" href=\"https://redacted.instructure.com/courses/2465103/pages/5383d9c\" data-api-endpoint=\"https://redacted.instructure.com/api/v1/courses/2465103/pages/5383d9c\" data-api-returntype=\"Page\">redacted</a> redacted <a title=\"Redacted 45f7da0\" href=\"https://redacted.instructure.com/courses/2465103/pages/45f7da0\" data-api-endpoint=\"https://redacted.instructure.com/api/v1/courses/2465103/pages/45f7da0\" data-api-returntype=\"Page\">redacted</a></span>\n<ul>\n<li><span style=\"font-size: 12pt;\">redacted. </span></li>\n<li><span style=\"font-size: 12pt;\">Redacted. </span></li>\n<li><span style=\"font-size: 12pt;\">Redacted. </span></li>\n<li><span style=\"font-size: 12pt;\">Redacted.</span></li>\n</ul>\n</li>\n<li><span style=\"font-size: 12pt;\">Redacted.</span></li>\n</ul>\n<p>Redacted.</p>\n<p>Redacted</p>\n<p>Redacted.</p>\n<div style=\"width: 100%; text-align: right;\"><a href=\"#top\">Return to top</a></div>\n</div>\n<h2 id=\"Grades\" style=\"margin: 15px 0 15px 0; border-bottom: 5px solid #000000; width: 100%; height: 40px; text-align: center; line-height: 150%; font-size: x-large; background-color: #202020; color: #ffffff;\">Grading criteria</h2>\n<div id=\"Grades_Container\" style=\"padding: 0px 10px 10px 10px; border: solid #b0b0b0 1px; overflow: hidden;\">\n<p>Redacted.</p>\n<div style=\"width: 100%; text-align: right;\"><a href=\"#top\">Return to top</a></div>\n</div>\n<p><span><a id=\"Bottom\"></a></span></p>",
    "due": "Redacted",
    "icon": null,
    "name": "Redacted",
    "points": 0,
    "url": "https://redacted.instructure.com/courses/2465103/assignments/33132911"
},