Skip to content

Commit

Permalink
Add table support for markdown to HTML conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinEtchells committed May 15, 2024
1 parent 660db3c commit 3e4eebb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
3 changes: 2 additions & 1 deletion django_app/frontend/js/sessions/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class MarkdownConverter extends HTMLElement {
update(markdown) {
let converter = new showdown.Converter({
disableForced4SpacesIndentedSublists: true,
headerLevelStart: 3
headerLevelStart: 3,
tables: true
});
const html = converter.makeHtml(markdown);
this.innerHTML = /** @type any */ (DOMPurify.sanitize(html, {RETURN_TRUSTED_TYPE: true}));
Expand Down
11 changes: 11 additions & 0 deletions django_app/frontend/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion django_app/frontend/style.css.map

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions django_app/frontend/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ $redbox-red: #A50202;
display: block;
overflow-x: auto;
}
.iai-chat-message__text table {
border-collapse: collapse;
width: 100%;
}
.iai-chat-message__text th, .iai-chat-message__text td {
border: 1px solid black;
padding: 0.25rem;
text-align: left;
}

.iai-response-feedback {
display: none;
Expand Down

0 comments on commit 3e4eebb

Please sign in to comment.