Skip to content

API

Provides tools for working with Gemtext.

Gemtext

Gemtext(text: str)

A Gemtext parser.

Parameters:

Name Type Description Default

text

str

The Gemtext content to parse.

required

content cached property

content: tuple[Line, ...]

The content of the Gemtext.

This is a tuple of objects representing the parsed lines of the Gemtext content.

__str__

__str__() -> str

Return the Gemtext content as a string.

Heading

Heading(content: str, level: int)

Bases: Line

A heading line in Gemtext.

Parameters:

Name Type Description Default

content

str

The content of the heading.

required

level

int

The level of the heading (1-3).

required

level property

level: int

The level of the heading.

Line

Line(content: str)

A single line of Gemtext.

Parameters:

Name Type Description Default

content

str

The content of the line.

required

__repr__

__repr__() -> str

Return a string representation of the line.

__str__

__str__() -> str

Return the content of the line as a string.

Bases: Line

A link line in Gemtext.

Parameters:

Name Type Description Default

uri

str

The URI of the link.

required

description

str

The description of the link.

required

uri property

uri: str

The URI of the link.

ListItem

ListItem(content: str)

Bases: Line

A list item line in Gemtext.

Paragraph

Paragraph(content: str)

Bases: Line

A paragraph line in Gemtext.

PreFormatted

PreFormatted(content: str)

Bases: Line

A preformatted block of lines in Gemtext.

Quote

Quote(content: str)

Bases: Line

A quote line in Gemtext.