amundsen-io / amundsen

Amundsen is a metadata driven application for improving the productivity of data analysts, data scientists and engineers when interacting with data.
https://www.amundsen.io/amundsen/
Apache License 2.0
4.44k stars 960 forks source link

#535 missed Html rendering configs #711

Closed pPanda-beta closed 1 year ago

pPanda-beta commented 4 years ago

Html tags are not properly rendered

Since markdown is superset of html, at least basic html tags needs to be rendered https://github.com/amundsen-io/amundsenfrontendlibrary/pull/535 has missed some part.

Expected Behavior

Markdown <a href="..."> Some link </a> renders to a hyperlink

Current Behavior

The hyperlink is holding nothing in it, and title is going outside as a next dom sibling with a span.

Possible Solution

Correct solution :

Use import const ReactMarkdown = require('react-markdown/with-html') As mentioned in react-markdown readme

Hack :

Wrap the anchor in a div node <div> <a href="..."> Some link </a> </div>

Adventures Hack - only when you feel bored :

Wrap the anchor in a div node

 <a id="bad_link_1" href="..."> </a> 

<img src="/static/images/airflow.jpeg" onload="document.querySelector('#bad_link_1').innerText = 'Overridden Link Title -Hohoho ' "  hidden=true> </img>

Steps to Reproduce

  1. Load any table details page
  2. Add description This block of Markdown contains <a href="https://en.wikipedia.org/wiki/HTML">HTML</a>, and will require the <code>html-parser</code> AST plugin to be loaded, in addition to setting the <code class="prop">escapeHtml</code> property to false.
  3. Thats it

Screenshots (if appropriate)

image

Context

This is very similar to https://github.com/rexxars/react-markdown/issues/99

Why is it so important? I could have lived with markdown links

Well, the actual requirement was to open the link in a new tab. Which can only be done using target=_blank or onclick=window.open(...) . I chose the prior one to deal with a js free static html life.

Your Environment

Amunsen version used: dockerimages : amundsendev/amundsen-search:2.4.0 amundsendev/amundsen-metadata-oidc@sha256:166ac204f774088f792a2811504d7aaaabe9beb6cbfe8514142f862b2608d4b4 (once 2.5.5) amundsendev/amundsen-frontend-oidc@sha256:17d5f316c3990c1cce557b9240c1175d231ced4c963f9549a8326fff1001f524 (once 2.3.0)

Deployment: k8s behind ingress

madison-ookla commented 3 years ago

Slightly related question, it looks like you've inlined a Metabase graph - can you describe how you accomplished that? I'm trying to do something similar with iframes and it doesn't appear to be working as I expected. I've also tried wrapping it in a div block as you suggested to no avail (the html escaped text just shows up).

pPanda-beta commented 3 years ago

@madison-ookla can you please share the dom output?

madison-ookla commented 3 years ago

@madison-ookla can you please share the dom output?

Here's the DOM content after editing a table description to add in an iframe:

Screen Shot 2020-12-08 at 7 26 02 AM

This is what the page looks like: (edit)

Screen Shot 2020-12-08 at 7 28 24 AM

(updated)

Screen Shot 2020-12-08 at 7 28 13 AM