fix: render urls in table (#248)

This commit is contained in:
Brian Strauch
2023-08-22 12:39:50 -07:00
committed by GitHub
parent 49e7da3ec8
commit b8953ce4af
3 changed files with 15 additions and 10 deletions
+7 -2
View File
@@ -306,8 +306,13 @@ func (tr *ANSIRenderer) NewElement(node ast.Node, source []byte) Element {
s := ""
n := node.FirstChild()
for n != nil {
s += string(n.Text(source))
// s += string(n.LinkData.Destination)
switch t := n.(type) {
case *ast.AutoLink:
s += string(t.Label(source))
default:
s += string(n.Text(source))
}
n = n.NextSibling()
}
+4 -4
View File
@@ -1,4 +1,4 @@
| Label | Value |
| ------ | ----- |
| First | foo |
| Second | bar |
| Label | Value | URL |
| ------ | ----- | ---------------- |
| First | foo | https://charm.sh |
| Second | bar | https://charm.sh |
+4 -4
View File
@@ -1,5 +1,5 @@
LABEL | VALUE
---------+--------
First | foo
Second | bar
LABEL | VALUE | URL
---------+-------+-------------------
First | foo | https://charm.sh
Second | bar | https://charm.sh