test_eq(td("abc"), '<td style="text-align:left;">abc</td>')
class MyClass:
def _repr_html_(self): return "<span>blah</span>"
test_eq(td(MyClass()), '<td style="text-align:left;"><span>blah</span></td>')html
Some HTML Utilities
td
td (obj)
Create a table entry from string or object with html representation.
If an object is not a string, try to use its _repr_html_ method:
th
th (cells)
Create a table header
tr
tr (cells)
Create a table row
ROW
ROW (cells)
row
row (cells)
Create a table with a single row
table
table (rows, header='', cls:str='gtbook_table')
Create a table from rows
Create a table row
test_eq(tr(["a", "b"]),'<tr>\n<td style="text-align:left;">a</td>\n<td style="text-align:left;">b</td>\n</tr>')from IPython.display import HTML| 1 | 2 |
| a | b |
| c | d |
HTML(table([tr(["a", "b"]), tr(["c", "d"])], header=th(["1", "2"])))HTML(table([tr(["a", "b"]) for j in range(4)]))| a | b |
| a | b |
| a | b |
| a | b |
import gtsam
from gtbook.display import showprior = gtsam.DiscreteDistribution((0,2),"3/1")
HTML(row([prior, prior]))P(0):
|
P(0):
|
ROW([prior, show(prior)])P(0):
|