Package-level declarations

Types

Link copied to clipboard
@Serializable
sealed class OrgBlock : OrgElem
Link copied to clipboard
@Serializable
sealed class OrgChunk : OrgElem

A chunk is a block of org mode text that can be of various types as listed here

Link copied to clipboard
@Serializable
data class OrgDocument(val preamble: OrgPreamble, val preface: OrgPreface, val content: List<OrgSection>, var tokens: List<Token>) : OrgElem

Represents org document with all info present 'in' the file.

Link copied to clipboard
@Serializable
sealed interface OrgElem

Any parsed org element which keeps tracks of the tokens used in parsing

Link copied to clipboard
@Serializable
data class OrgHeading(val title: OrgLine, val level: OrgHeadingLevel, val tags: OrgTags? = null, val todoState: OrgTODOState? = null, val priority: OrgPriority? = null, val planningInfo: OrgPlanningInfo? = null, val properties: OrgProperties? = null, var tokens: List<Token>) : OrgElem
Link copied to clipboard
@Serializable
data class OrgHeadingLevel(val level: Int, var tokens: List<Token>) : OrgElem
Link copied to clipboard
@Serializable
sealed class OrgInlineElem : OrgElem

A piece of text in org mode with consistent styling and interpretation

Link copied to clipboard
@Serializable
data class OrgLine(val items: List<OrgInlineElem>, var tokens: List<Token>) : OrgElem

A single line string with Org Mode formatting enabled

Link copied to clipboard
@Serializable
sealed class OrgList

Org list which could have nested lists inside or list content

Link copied to clipboard
Link copied to clipboard
@Serializable
data class OrgOptions(val map: Map<String, String>, var tokens: List<Token>) : OrgElem

Options that could go in top of the file, code block headers, etc.

Link copied to clipboard
@Serializable
data class OrgParsingError(val message: String, var tokens: List<Token> = emptyList()) : OrgElem

Represents parsing error of all kinds

Link copied to clipboard
@Serializable
data class OrgPlanningInfo(val scheduled: OrgInlineElem.DTStamp?, val deadline: OrgInlineElem.DTStamp?, val closed: OrgInlineElem.DTStamp?, var tokens: List<Token>) : OrgElem
Link copied to clipboard
@Serializable
data class OrgPreamble(val title: OrgLine, val author: String? = null, val email: String? = null, val date: LocalDate? = null, val category: String? = null, val filetags: OrgTags? = null, val tags: OrgTags? = null, val options: OrgOptions? = null, val pile: OrgOptions? = null, val properties: OrgProperties? = null, var tokens: List<Token>) : OrgElem

Preamble is everything that comes in the start before the actual content starts

Link copied to clipboard
@Serializable
data class OrgPreface(val body: List<OrgChunk>, var tokens: List<Token>) : OrgElem

Preface contains the chunks before first heading

Link copied to clipboard
@Serializable
data class OrgPriority(val priority: Int, val text: String, var tokens: List<Token>) : OrgElem
Link copied to clipboard
@Serializable
data class OrgProperties(val map: Map<String, OrgLine>, var tokens: List<Token>) : OrgElem

Unlike simple options, org properties could have full fledged org-mode text

Link copied to clipboard
@Serializable
data class OrgSection(val heading: OrgHeading, val body: List<OrgChunk>, var tokens: List<Token>) : OrgChunk, OrgElem

A section is an org chunk with heading attached to it

Link copied to clipboard
@Serializable
data class OrgTableRow(val cells: List<OrgLine>, var tokens: List<Token>) : OrgElem
Link copied to clipboard
@Serializable
data class OrgTags(val tags: List<String>, var tokens: List<Token>) : OrgElem

Tags for files or headings or anywhere else

Link copied to clipboard
@Serializable
data class OrgTODOState(val text: String, val isDone: Boolean, var tokens: List<Token>) : OrgElem
Link copied to clipboard
@Serializable
data class OrgToken(var tokens: List<Token>) : OrgElem

Represents a plain token parse

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Parse a datetime range. This is not just time range which is usually represented in the datetime stamp itself.

Link copied to clipboard

Parse single datetime stamp

Link copied to clipboard
Link copied to clipboard

Parse tags with metrics like #hash-tag(value)

Link copied to clipboard

Parse hashtags like #hash #hash-tag etc.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Parse an org mode link

Link copied to clipboard

Parse a single line of org inline elements

Link copied to clipboard

Preamble is everything before the start of actual content.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Convert list of inline elements to plain text. This is not the same as recovering the original org mode string since markups, links etc. are ignored here.

Link copied to clipboard
Link copied to clipboard
fun parse(tokens: List<Token>): OrgDocument?

The main exposed function for parsing an org mode document

Link copied to clipboard
fun parseInlineElems(stoppingFn: (List<Token>) -> Boolean = { false }): Parser<List<OrgInlineElem>>

Build a parser that continues to parse inline element till stopping criteria is met.

Link copied to clipboard

Starting just after the list marker and space, parse the list item.

Link copied to clipboard

This starts after the checkbox, if present, in each list item and parses the chunks that make up one list item.

Link copied to clipboard

Parse a list item along with the marker and space between them. This starts at the position of the list marker and only parses items of given indent.

Link copied to clipboard

Return plain text representation of paragraph

Link copied to clipboard
fun unparse(document: OrgDocument): List<Token>

Convert a document back to the list to tokens