Packages

Earmark is a pure-Elixir Markdown converter. It is intended to be used as a library (just call Earmark.as_html), but can also be used as a command-line tool (run mix escript.build first). Output generation is pluggable.

Retired package: Deprecated - Earmark is no longer maintained. Migrate to a replacement, for example MDEx (https://hex.pm/packages/mdex).
Security advisory: This version has known vulnerabilities. View advisories

Current section

Files

Jump to
earmark lib1 earmark sys_interface.ex
Raw

lib1/earmark/sys_interface.ex

defmodule Earmark.SysInterface do
@doc """
A proxy to IO.stream(..., :line) or usage with a filename
"""
def readlines(device_or_filename)
def readlines(filename) when is_binary(filename) do
IO.inspect(filename, label: :inside)
case File.open(filename, [:utf8]) do
{:ok, device} -> readlines(device)
{:error, _} = error -> error
end
end
def readlines(device) do
IO.inspect(device, label: :device)
IO.stream(device, :line)
end
end
# SPDX-License-Identifier: Apache-2.0