ITI / searcch

SEARCCH Hub Frontend
https://searcch.cyberexperimentation.org/
BSD 3-Clause "New" or "Revised" License
3 stars 6 forks source link

Problem about rendering markdown tables inside HTML tags #173

Closed ckouder closed 1 year ago

ckouder commented 1 year ago

The problem David J mentions that markdown tables do not render in HAI artifact is caused by a renderer failure on markdown tables inside html tags. Here is an image to the source code that causes the failure: image And here is an image to the showdownJS official demo website to show the origin of the problem:

image

However, the markdown table does get rendered after html tags are removed. As shown in this picture:

image

ShowdownJS by default does not support markdown inside html tags unless the creator of markdown specifies a html attribute markdown=1 inside a html tag e.g. <sometag markdown="1"></sometag>. However, the solution is impossible in our use cases. We might need to look into other markdown renderers; even though that means redoing all XSS tests on another renderer.

I've tested markdown-it and it works perfectly with markdown tables inside html tags (XSS tests not done yet).

image

However, I think a discussion might still be needed in case if there is some other edge cases that markdown-it might fail.... what do you think? @lauratinnel @dpemmerich @carboxylman

carboxylman commented 1 year ago

markdown-it seems good to me! I don't know any other use cases beyond these we've encountered.

ckouder commented 1 year ago

This is the proof of concept for markdown-it: https://stackblitz.com/edit/nuxt-starter-eqm5kg?file=pages%2Findex.vue,nuxt.config.js,package.json. It solves the problems we encounter

dpemmerich commented 1 year ago

I think the next step would be to make the needed changes in the code base in a branch for this, then when ready, we'll merge to development to get it in front of the other PI's

carboxylman commented 1 year ago

I merged #176, and tested that it works for this particular artifact -- so closing this issue.