Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 source pure

Package mdlist is a proof-of-concept for composable UIs patterns.

Readme View source

gno.land/p/nym-moultest123/mdlist

🧪 Proof of concept. It explores a composable-UI idea rather than offering a settled API.

The idea: a realm should describe its data once and choose the presentation at Render time, instead of building a different string for each layout.

1entries := mdlist.Entries{
2	{Title: "First", Body: "Some text", Link: "/r/x:1"},
3	{Title: "Second", Body: "More text", Link: "/r/x:2"},
4}
5
6out := entries.BulletList()       // or NumberedList, Paragraphs, Columns
method output
BulletList() - **Title** body
NumberedList() 1. **Title** body
Paragraphs() bold title, then the body as a paragraph
Columns() a grid
BulletListTruncated(t, b) as above, title and body cut to t / b runes
NumberedListTruncated(t, b) same

One Entries value, six renderings. A realm that stores its data as Entries can switch layout from a query parameter, and a caller embedding that realm's list can pick the shape that fits its own page.

Truncation takes explicit limits rather than guessing, because the right cut depends on where the list is being embedded.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/p/nym-moultest123/mdlist/v0 dependency graph

⚠️ Disclaimer: provided as-is, without warranty; not security-audited. Full disclaimer: DISCLAIMER.

Overview

Package mdlist is a proof-of-concept for composable UIs patterns.

It allows specifying a data source and then dynamically rendering it as a list or a grid.

Types 2

type Entries

slice
1type Entries []Entry
source

Methods on Entries

func BulletList

method on Entries
1func (l Entries) BulletList() string
source

BulletList returns entries as a markdown bullet list without truncation.

func BulletListTruncated

method on Entries
1func (l Entries) BulletListTruncated(titleMaxLength, bodyMaxLength int) string
source

BulletListTruncated returns entries as a markdown bullet list with truncation.

func Columns

method on Entries
1func (l Entries) Columns() string
source

func NumberedList

method on Entries
1func (l Entries) NumberedList() string
source

NumberedList returns entries as a markdown numbered list without truncation.

func NumberedListTruncated

method on Entries
1func (l Entries) NumberedListTruncated(titleMaxLength, bodyMaxLength int) string
source

NumberedListTruncated returns entries as a markdown numbered list with truncation.

func Paragraphs

method on Entries
1func (l Entries) Paragraphs() string
source

Paragraphs returns entries as simple paragraphs with bold titles.

type Entry

struct
 1type Entry struct {
 2	// Title is the title of the entry. Required.
 3	Title string
 4	// Body is the body of the entry. Required.
 5	Body string
 6	// Link is the URL of the entry. Optional.
 7	Link string
 8	// Links is a list of additional URLs of the entry. Optional.
 9	Links []string
10}
source

Dependencies

Source Files 4