Masu.Snapshot (Masu v0.7.0)

Copy Markdown View Source

A grid's rows as they are now, as a table that reads without the grid: Markdown, for a document exported with a grid in it (a Kotoba embed), and HTML, for a page or an email that shows the document.

sheet = Masu.Sheet.new(MyApp.Grids.tasks(scope))
Masu.Snapshot.markdown(sheet, view: saved_view.params, rows: 20)
| Task | Due | Done |
| :--- | :--- | :---: |
| Write the guide | 2026-11-02 | false |

_And 37 more rows._

Options:

  • :view - a view's params (Masu.View, a saved view's params): its order, filters, search, and columns that show. The grid's own view unless given.
  • :rows - how many rows, at most (20 unless given, 500 at most).
  • :more - what follows the rows when the query has more, a function of how many more ("And 37 more rows." unless given), or nil for nothing.

A cell is its value as text: a date in ISO 8601, a decimal to its last digit. Cells of your own HEEx are their column's value.

Summary

Functions

The snapshot as an HTML table (table.masu-snapshot), safe HTML.

The snapshot as a Markdown table.

The rows and columns of the snapshot, as text: %{columns:, rows:, more:}, more the rows of the query past those, or nil when the source does not count.

Types

table()

@type table() :: %{
  columns: [Masu.Column.t()],
  rows: [[String.t()]],
  more: non_neg_integer() | nil
}

Functions

html(sheet, opts \\ [])

@spec html(Masu.Sheet.t(), keyword()) :: Phoenix.HTML.safe()

The snapshot as an HTML table (table.masu-snapshot), safe HTML.

markdown(sheet, opts \\ [])

@spec markdown(Masu.Sheet.t(), keyword()) :: String.t()

The snapshot as a Markdown table.

table(sheet, opts \\ [])

@spec table(Masu.Sheet.t(), keyword()) :: table()

The rows and columns of the snapshot, as text: %{columns:, rows:, more:}, more the rows of the query past those, or nil when the source does not count.