DprintMarkdownFormatter.Native (dprint_markdown_formatter v0.3.0)
View SourceNative interface for dprint markdown formatting using Rustler.
This module loads the Rust NIF that provides the actual formatting functionality.
Summary
Functions
Formats markdown text with configurable options.
Functions
Formats markdown text with configurable options.
This function is implemented in Rust and provides the core formatting functionality using the dprint-plugin-markdown library.
Parameters
text
- The markdown text to formatoptions
- A map of formatting options (seeformat_options/0
type)
Returns
{:ok, formatted_text}
on successful formatting{:error, error_message}
if formatting fails
Examples
iex> options = %{line_width: 80, text_wrap: :always, emphasis_kind: :asterisks, strong_kind: :asterisks, new_line_kind: :auto, unordered_list_kind: :dashes}
iex> DprintMarkdownFormatter.Native.format_markdown("# Hello World", options)
{:ok, "# Hello World\n"}
iex> DprintMarkdownFormatter.Native.format_markdown("* Item 1\n* Item 2", options)
{:ok, "- Item 1\n- Item 2\n"}