Documentation
¶
Overview ¶
Package mdtable writes tables as markdown. DOCX, PPTX, XLSX and HTML each describe a table differently, merged cells above all; their readers build a Table and RenderMarkdown writes it, so a table looks the same whatever file it came from.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromSpanRows ¶
FromSpanRows resolves rows of cells with ColSpan/RowSpan (the HTML model: a spanned cell is written once and the positions it covers are left out of the later rows) into a Table.
Types ¶
type Table ¶
type Table struct {
Caption string
Rows [][]string
HeaderRows int // how many leading rows are header rows; 0 when the file does not say
}
Table is a table once its merged cells have been resolved: every row has one string per column, and a cell that spans several rows or columns has its text in each of the positions it covers. Markdown has no merged cells, and a row that is missing the value its neighbour spans stops making sense once a table is cut into chunks, so each row carries all of its own values.
func (Table) RenderMarkdown ¶
RenderMarkdown writes the table as a GitHub-flavored markdown table. Rows and columns with nothing in them (spacers) are dropped; several header rows become one, each column's parts joined with " / "; a table with one column is a list in disguise (a layout table, a boxed paragraph) and is written as lines.