add support to markdown tables, #1886 (#2037)

* add support to markdown tables, #1886

* formatting

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
Vilém Zouhar 2022-08-20 01:43:24 +02:00 committed by GitHub
parent f66c104fc2
commit b6a56b57b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View File

@ -2758,7 +2758,7 @@ class Dataframe(Changeable, IOComponent):
return data
if cls.markdown_parser is None:
cls.markdown_parser = MarkdownIt()
cls.markdown_parser = MarkdownIt().enable("table")
for i in range(len(data)):
for j in range(len(data[i])):
@ -4231,7 +4231,7 @@ class Markdown(IOComponent, Changeable):
visible: If False, component will be hidden.
elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
"""
self.md = MarkdownIt()
self.md = MarkdownIt().enable("table")
load_fn, initial_value = self.get_load_fn_and_initial_value(value)
self.value = self.postprocess(initial_value)
IOComponent.__init__(

View File

@ -288,14 +288,18 @@ class Interface(Blocks):
cleantext = re.sub(CLEANER, "", raw_html)
return cleantext
md = MarkdownIt(
"js-default",
{
"linkify": True,
"typographer": True,
"html": True,
},
).use(footnote_plugin)
md = (
MarkdownIt(
"js-default",
{
"linkify": True,
"typographer": True,
"html": True,
},
)
.use(footnote_plugin)
.enable("table")
)
simple_description = None
if description is not None: