6 Struct n_markdown_block
gullradriel edited this page 2026-11-01 17:45:54 +01:00

n_markdown_block

One block. More...

#include "n_markdown.h"

Public Attributes

Name
long start
With N_MARKDOWN_NESTED, OL: the number of its first item ("3. " gives 3).
size_t n_items
size_t n_cols
TABLE: cells per row, always at least 1.
int level
HEADING: 1 to 6.
int kind
enum n_markdown_block_kind
n_markdown_inline * items
n_markdown_inline inl
int depth
With N_MARKDOWN_NESTED: how many list items the block sits under, 0 at the top.
char * code
unsigned char * align
TABLE: N_MARKDOWN_ALIGN_* per column, [n_cols](Struct-n_markdown_block#user-content-variable-n_cols) entries, owned.

Detailed Description

struct n_markdown_block;

One block.

inl holds spans for PARA/QUOTE/HEADING; code holds the raw text for CODE_BLOCK (owned, NUL-terminated, else NULL); items holds the list rows for UL/OL and the cells for TABLE (else NULL).

A TABLE's cells are stored in [items](Struct-n_markdown_block#user-content-variable-items) row by row, [n_cols](Struct-n_markdown_block#user-content-variable-n_cols) to a row, so cell (r, c) is [items](Struct-n_markdown_block#user-content-variable-items)[r * [n_cols](Struct-n_markdown_block#user-content-variable-n_cols) + c] and there are [n_items](Struct-n_markdown_block#user-content-variable-n_items) / [n_cols](Struct-n_markdown_block#user-content-variable-n_cols) rows. The first row is the header. [align](Struct-n_markdown_block#user-content-variable-align) has one entry per column. Two arrays and no nested type: it is the same flat model the spans use, and [n_markdown_free](n__markdown_8c#user-content-function-n_markdown_free) already knew how to release [items](Struct-n_markdown_block#user-content-variable-items).

Public Attributes Documentation

variable start

long start;

With N_MARKDOWN_NESTED, OL: the number of its first item ("3. " gives 3).

0 without it, and for every other kind: count from 1.

variable n_items

size_t n_items;

variable n_cols

size_t n_cols;

TABLE: cells per row, always at least 1.

Zero for every other kind.

variable level

int level;

HEADING: 1 to 6.

Zero for every other kind.

variable kind

int kind;

enum n_markdown_block_kind

variable items

n_markdown_inline * items;

variable inl

n_markdown_inline inl;

variable depth

int depth;

With N_MARKDOWN_NESTED: how many list items the block sits under, 0 at the top.

Always 0 without it.

variable code

char * code;

variable align

unsigned char * align;

TABLE: N_MARKDOWN_ALIGN_* per column, [n_cols](Struct-n_markdown_block#user-content-variable-n_cols) entries, owned.

NULL for every other kind.