Improved docs for table/grid (#3615)

This commit is contained in:
Andrew Voynov 2024-03-11 16:33:15 +03:00 committed by GitHub
parent 515f5b6b4f
commit d01ccffad6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 14 deletions

View File

@ -164,7 +164,7 @@ pub struct GridElem {
#[borrowed] #[borrowed]
pub rows: TrackSizings, pub rows: TrackSizings,
/// The gaps between rows & columns. /// The gaps between rows and columns.
/// ///
/// If there are more gutters than defined sizes, the last gutter is repeated. /// If there are more gutters than defined sizes, the last gutter is repeated.
#[external] #[external]
@ -185,9 +185,9 @@ pub struct GridElem {
/// How to fill the cells. /// How to fill the cells.
/// ///
/// This can be a color or a function that returns a color. The function is /// This can be a color or a function that returns a color. The function
/// passed the cells' column and row indices, starting at zero. This can be /// receives the cells' column and row indices, starting from zero. This can
/// used to implement striped grids. /// be used to implement striped grids.
/// ///
/// ```example /// ```example
/// #grid( /// #grid(
@ -210,7 +210,7 @@ pub struct GridElem {
/// ///
/// This can either be a single alignment, an array of alignments /// This can either be a single alignment, an array of alignments
/// (corresponding to each column) or a function that returns an alignment. /// (corresponding to each column) or a function that returns an alignment.
/// The function is passed the cells' column and row indices, starting at /// The function receives the cells' column and row indices, starting from
/// zero. If set to `{auto}`, the outer alignment is used. /// zero. If set to `{auto}`, the outer alignment is used.
/// ///
/// You can find an example for this argument at the /// You can find an example for this argument at the

View File

@ -129,8 +129,8 @@ pub struct TableElem {
#[borrowed] #[borrowed]
pub rows: TrackSizings, pub rows: TrackSizings,
/// The gaps between rows & columns. See the [grid documentation]($grid) for /// The gaps between rows and columns. See the [grid documentation]($grid)
/// more information on gutters. /// for more information on gutters.
#[external] #[external]
pub gutter: TrackSizings, pub gutter: TrackSizings,
@ -151,13 +151,15 @@ pub struct TableElem {
/// How to fill the cells. /// How to fill the cells.
/// ///
/// This can be a color or a function that returns a color. The function is /// This can be a color or a function that returns a color. The function
/// passed the cells' column and row indices, starting at zero. This can be /// receives the cells' column and row indices, starting from zero. This can
/// used to implement striped tables. /// be used to implement striped tables.
/// ///
/// ```example /// ```example
/// #table( /// #table(
/// fill: (col, _) => if calc.odd(col) { luma(240) } else { white }, /// fill: (col, _) =>
/// if calc.odd(col) { luma(240) }
/// else { white },
/// align: (col, row) => /// align: (col, row) =>
/// if row == 0 { center } /// if row == 0 { center }
/// else if col == 0 { left } /// else if col == 0 { left }
@ -176,7 +178,7 @@ pub struct TableElem {
/// ///
/// This can either be a single alignment, an array of alignments /// This can either be a single alignment, an array of alignments
/// (corresponding to each column) or a function that returns an alignment. /// (corresponding to each column) or a function that returns an alignment.
/// The function is passed the cells' column and row indices, starting at /// The function receives the cells' column and row indices, starting from
/// zero. If set to `{auto}`, the outer alignment is used. /// zero. If set to `{auto}`, the outer alignment is used.
/// ///
/// ```example /// ```example
@ -683,8 +685,8 @@ pub struct TableVLine {
/// properties for a particular cell, or use it in show rules to apply certain /// properties for a particular cell, or use it in show rules to apply certain
/// styles to multiple cells at once. /// styles to multiple cells at once.
/// ///
/// Perhaps the most important use-case of `{table.cell}` is to make a cell span /// Perhaps the most important use case of `{table.cell}` is to make a cell span
/// multiple columns or rows with the `colspan` and `rowspan` fields. /// multiple columns and/or rows with the `colspan` and `rowspan` fields.
/// ///
/// ```example /// ```example
/// >>> #set page(width: auto) /// >>> #set page(width: auto)