Can't alias a hyperlink in the output of build_table()
abshomali opened this issue · 2 comments
The build_table
function is able to handle outputting a clickable hyperlink, but if you try and alias that link as another string, the functionality doesn't seem to work. This use case is handled in the Pandas to_html
method using the escape=False
flag.
Example below.
This code works fine.
import pandas as pd
df = pd.DataFrame()
my_url = 'https://google.com'
df[url] = my_url
build_table(df, 'blue_light')
But the code below just outputs the exact text of my_url_alias
(including the "<a" tag and "href") instead of outputting the word "Click" that is clickable as a hyperlink.
import pandas as pd
df = pd.DataFrame()
my_url = 'https://google.com'
my_url_alias = '<a href="https://google.com"> Click </a>'
df[url] = my_url_alias
build_table(df, 'blue_light')
The second use case can accomplished in the native Pandas to_html()
method using the following code:
import pandas as pd
df = pd.DataFrame()
my_url = 'https://google.com'
my_url_alias = '<a href="https://google.com"> Click </a>'
df[url] = my_url_alias
df.to_html(escape=False)
Hello @abshomali,
Let me take a look at this.
I also accept pull request :)
I included the escape option, could you try it out now and let me know?
default is escape=True