markdown
markdown copied to clipboard
Run Markdown through a try-catch in the Explorer
If someone happens to have an API Reference page with the following Markdown with invalid CSS, the Markdown engine will currently fail, taking the rest of the Explorer component down with it.
<p style="font-size:15px;font-family=Lato, proxima-nova, Helvetica Neue, Arial, sans-serif;color: #001a00;text-align:justify;">Pickup location are required to be created from where pickup has to be done. One time pickup location can also be created through Warehouse creation API.</p>
All Markdown runs through the Explorer should be handled through a try-catch so if it fails, we just fallback to rendering plaintext.
is this still an issue? I tried it locally and it only seems to break the single endpoint (rather than the whole explorer?) But if it is, I think we could wrap a try/catch around the default RDMD export and fix this e’erywhere in one fell swoop, no? Something like:
const ReadMeMarkdown = (text, opts = {}) => {
try {
return react(text, opts);
} catch (e) {
console.error(e);
return e;
}
};