Documentation
¶
Overview ¶
Markdown core does not support tables; for the most portable support, assuming HTML is the final target, use the `html` sub-package instead.
Support for GitHub-Flavored Markdown's Tables is fairly widespread in markdown packages. That's the dialect which we speak at this time.
Note that the data model supported by GFM tables is very limited and is likely to break on a number of valid inputs. We attempt to deal "safely" with this, to meet the security model, but it's likely that there are inputs which break the integrity of the markdown table for various renderers. Again, the solution is to use the HTMLTable wrapper instead.
So why have this sub-package? In my experience, people working on documentation like to be able to use the same input data and ask the tools to generate markdown, which can then be included as-is, for output in various formats. Thus we have _two_ target audiences: a human reviewing our output as it goes into .md documents, and people viewing the rendered tables later. We need to look "decent" for both, but can defer sanitization to the human review step.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotCellProperties = errors.New("markdowntable: width-set: not given a cell")
Functions ¶
Types ¶
type MarkdownTable ¶
A MarkdownTable wraps a tabular.Table to act as a render control for Markdown output.
func New ¶
func New() *MarkdownTable
New returns a MarkdownTable with a new Table inside it, access via .Table or just use the interface methods on the MarkdownTable.
func Wrap ¶
func Wrap(t tabular.Table) *MarkdownTable
Wrap returns a MarkdownTable rendering object for the given tabular.Table.
func (*MarkdownTable) Render ¶
func (mt *MarkdownTable) Render() (string, error)
Render takes a tabular Table and returns a string representing the fully rendered table or an error.