Any Markdown-formatted text in the incoming cells will be transformed during render when using the fmt_markdown() method.
Parameters
Name
Type
Description
Default
columns
SelectExpr
The columns to target. Can either be a single column name or a series of column names provided in a list.
None
rows
int | list[int] | None
In conjunction with columns=, we can specify which of their rows should undergo formatting. The default is all rows, resulting in all rows in targeted columns being formatted. Alternatively, we can supply a list of row indices.
The GT object is returned. This is the same object that the method is called on so that we can facilitate method chaining.
Examples:
Let’s first create a DataFrame containing some text that is Markdown-formatted and then introduce that to GT(). We’ll then transform the md column with the fmt_markdown() method.
import pandas as pdfrom great_tables import GTfrom great_tables.data import townytext_1 ="""### This is Markdown.Markdown’s syntax is comprised entirely ofpunctuation characters, which punctuationcharacters have been carefully chosen so asto look like what they mean... assumingyou’ve ever used email."""text_2 ="""Info on Markdown syntax can be found[here](https://daringfireball.net/projects/markdown/)."""df = pd.DataFrame({"md": [text_1, text_2]})(GT(df).fmt_markdown("md"))
md
This is Markdown.
Markdown’s syntax is comprised entirely of
punctuation characters, which punctuation
characters have been carefully chosen so as
to look like what they mean... assuming
you’ve ever used email.