markright v0.2.9 Markright.Parsers.Pre

Parses the input for the code block.

Examples

iex> input = "ruby
...> $ ls -la
...> ```
...> Other text.
...> "
iex> Markright.Parsers.Pre.to_ast(input)
%Markright.Continuation{
  ast: {:pre, %{}, [{:code, %{lang: "ruby"}, "$ ls -la"}]},
  tail: "\n Other text."}

iex> input = "
...> $ ls -la
...> ```
...> Other text.
...> "
iex> Markright.Parsers.Pre.to_ast(input)
%Markright.Continuation{
  ast: {:pre, %{}, [{:code, %{}, "$ ls -la"}]}, tail: "\n Other text."}

iex> input = "elixir
...> def f(\"\"), do: :empty_string
...>
...> def f([]), do: :empty_list
...> ```
...> Other text.
...> "
iex> Markright.Parsers.Pre.to_ast(input)
%Markright.Continuation{ast: {:pre, %{},
       [{:code, %{lang: "elixir"},
         "def f(\"\"), do: :empty_string\n\n def f([]), do: :empty_list"}]},
      tail: "\n Other text."}

Summary

Functions

to_ast(input, fun \\ nil, opts \\ %{})

Callback implementation for Markright.Parser.to_ast/3.