luma_markdown
luma_markdown converts Luma markup to Markdown. It can read a file or consume
all of its input from standard input.
Standalone executable
Gleam can package the Erlang version of the program as an escript. An escript is one executable file containing the compiled program and its dependencies (it does require Erlang to be installed on the machine where it is run).
From the project directory, run:
gleam export escript
chmod +x luma_markdown
This creates the single executable ./luma_markdown. Re-run the export
command after changing the source. To use a different filename, rename the
generated file:
mv luma_markdown luma-md
Pass a file path as the only argument:
./luma_markdown input.luma
Or pipe content into it. The command receiving the pipe must come last:
echo "#1 A heading" | ./luma_markdown
cat input.luma | ./luma_markdown
When using a shell with history expansion (such as interactive zsh), use
single quotes or printf for input beginning with !:
printf '%s\n' '!4 emphasized text' | ./luma_markdown
With no arguments, the executable reads until standard input reaches EOF and writes the resulting Markdown to standard output.
Neovim preview
The working preview configuration is also included in
examples/neovim_luma_preview.lua. Copy it
into your Neovim configuration or source it with:
dofile(vim.fn.getcwd() .. "/examples/neovim_luma_preview.lua")
The snippet looks for luma_markdown on PATH. To use the executable in this
repository directly, set its path before starting Neovim:
export LUMA_MARKDOWN_BIN="$PWD/luma_markdown"
It registers the :LumaPreview command and automatically refreshes the
preview for *.luma files.
Development
gleam run -- input.luma # Run from the Gleam toolchain
gleam test # Run the tests
Further documentation can be found at https://hexdocs.pm/luma_markdown.