mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-23 10:42:00 +00:00
fix(matrix): preserve markdown table structure
This commit is contained in:
parent
4373e802a1
commit
45f9099e51
2 changed files with 19 additions and 1 deletions
|
|
@ -209,7 +209,7 @@ class _MatrixHtmlSanitizer(HTMLParser):
|
|||
_ALLOWED_TAGS = {
|
||||
"a", "b", "blockquote", "br", "code", "del", "em", "h1", "h2", "h3",
|
||||
"h4", "h5", "h6", "hr", "i", "li", "ol", "p", "pre", "s", "strike",
|
||||
"strong", "ul",
|
||||
"strong", "table", "tbody", "td", "th", "thead", "tr", "ul",
|
||||
}
|
||||
_VOID_TAGS = {"br", "hr"}
|
||||
|
||||
|
|
|
|||
|
|
@ -1090,6 +1090,24 @@ class TestMatrixMarkdownToHtml:
|
|||
assert "<code" in result
|
||||
assert "print" in result
|
||||
|
||||
def test_matrix_markdown_preserves_table_structure(self):
|
||||
table = "\n".join(
|
||||
[
|
||||
"| Item | Quantity |",
|
||||
"| --- | --- |",
|
||||
"| Apples | 4 |",
|
||||
"| Bread | 1 |",
|
||||
]
|
||||
)
|
||||
|
||||
result = self.adapter._markdown_to_html(table)
|
||||
|
||||
assert "<table>" in result
|
||||
assert "<thead>" in result
|
||||
assert "<tbody>" in result
|
||||
assert "<th>Item</th>" in result
|
||||
assert "<td>Apples</td>" in result
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Helper: display name extraction
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue