Skip to content

Commit

Permalink
Support tables in DAG docs (apache#13533)
Browse files Browse the repository at this point in the history
  • Loading branch information
jyotidhiman0610 authored Jan 15, 2021
1 parent dc80fa4 commit 3558538
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion airflow/www/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def wrapped_markdown(s, css_class=None):
if s is None:
return None

return Markup(f'<div class="{css_class}" >' + markdown.markdown(s) + "</div>")
return Markup(f'<div class="{css_class}" >' + markdown.markdown(s, extensions=['tables']) + "</div>")


# pylint: disable=no-member
Expand Down
17 changes: 17 additions & 0 deletions tests/www/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,20 @@ def test_wrapped_markdown_with_some_markdown(self):
<strong>bold</strong></p></div>''',
rendered,
)

def test_wrapped_markdown_with_table(self):
rendered = wrapped_markdown(
"""| Job | Duration |
| ----------- | ----------- |
| ETL | 14m |"""
)

self.assertEqual(
(
'<div class="None" ><table>\n<thead>\n<tr>\n<th>Job</th>\n'
'<th>Duration</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>ETL'
'</td>\n<td>14m</td>\n</tr>\n</tbody>\n'
'</table></div>'
),
rendered,
)

0 comments on commit 3558538

Please sign in to comment.