Skip to content

API

A simple finger to Gemtext converter.

AvailableServicesFilter

AvailableServicesFilter(peekable_lines: int = 20)

Bases: FingerFilter

Filter for Finger available services responses.

Parameters:

Name Type Description Default

peekable_lines

int

The number of lines to peek at when deciding the content type.

20

can_likely_convert

can_likely_convert(finger_content: str) -> bool

Check if the filter can likely convert the given Finger content.

Parameters:

Name Type Description Default

finger_content

str

The Finger content to check.

required

Returns:

Type Description
bool

True if the filter can likely convert the content; False otherwise.

to_gemtext

to_gemtext(finger_content: str) -> str

Convert the given finger content to Gemtext.

Parameters:

Name Type Description Default

finger_content

str

The Finger content to convert.

required

Returns:

Type Description
str

The converted Gemtext content.

FingerFilter

FingerFilter(peekable_lines: int = 10)

Bases: ABC

Base class for finger filters.

Parameters:

Name Type Description Default

peekable_lines

int

The number of lines to peek at when deciding the content type.

10

can_likely_convert abstractmethod

can_likely_convert(finger_content: str) -> bool

Check if the filter can likely convert the given Finger content.

Parameters:

Name Type Description Default

finger_content

str

The Finger content to check.

required

Returns:

Type Description
bool

True if the filter can likely convert the content; False otherwise.

peekable_lines

peekable_lines(finger_content: str) -> Iterator[str]

The number of lines to peek at when deciding the content type.

to_gemtext abstractmethod

to_gemtext(finger_content: str) -> str

Convert the given finger content to Gemtext.

Parameters:

Name Type Description Default

finger_content

str

The Finger content to convert.

required

Returns:

Type Description
str

The converted Gemtext content.

UserListFilter

UserListFilter(peekable_lines: int = 10)

Bases: FingerFilter

Filter for Finger user list responses.

can_likely_convert

can_likely_convert(finger_content: str) -> bool

Check if the filter can likely convert the given Finger content.

Parameters:

Name Type Description Default

finger_content

str

The Finger content to check.

required

Returns:

Type Description
bool

True if the filter can likely convert the content; False otherwise.

to_gemtext

to_gemtext(finger_content: str) -> str

Convert the given finger content to Gemtext.

Parameters:

Name Type Description Default

finger_content

str

The Finger content to convert.

required

Returns:

Type Description
str

The converted Gemtext content.

finger_to_gemtext

finger_to_gemtext(
    finger_content: str,
    additional_filters: Iterable[type[FingerFilter]]
    | None = None,
) -> str

Convert Finger content to Gemtext.

Parameters:

Name Type Description Default

finger_content

str

The Finger content to convert.

required

Returns:

Type Description
str

The converted Gemtext content.