org v0.1.0 Org.Lexer

Splits an org-document into tokens.

For many simple tasks, using the lexer is enough, and a full-fledged Org.Document is not needed.

Usage example:

iex> source = "#+TITLE: Greetings\n\n* Hello\n** World\n** Universe\n* Goodbye\n"
iex> Org.Lexer.lex(source)
[{:comment, "+TITLE: Greetings"},
 {:empty_line},
 {:section_title, 1, "Hello"},
 {:section_title, 2, "World"},
 {:section_title, 2, "Universe"},
 {:section_title, 1, "Goodbye"},
 {:empty_line}]

Link to this section Summary

Link to this section Types

Link to this type t()
t() :: %Org.Lexer{tokens: [token()]}
Link to this type token()
token() ::
  {:comment, String.t()} |
  {:section_title, integer(), String.t()} |
  {:table_row, [String.t()]} |
  {:empty_line} |
  {:text, String.t()}

Link to this section Functions

Link to this function lex(text)
lex(String.t()) :: [token()]