Skip to content
Adding link to hashed text in a markdown using Earmak's AST
Elixir
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.credo.exs
.formatter.exs
.gitignore
LICENSE
README.md
mix.exs
mix.lock

README.md

EarmarkHashedLink

It adds link to hashed text in a markdown using Earmark's AST feature. It doesn't only add but also switch behavior in its context (e.g. It doesn't add link to text in a code tag).

Status: EXPERIMENTAL

Installation

def deps do
  [
    {:earmark_hashed_link, github: "niku/earmark_hashed_link"}
  ]
end

Usage

markdown = "abc #hashedLink def\n`#hashedLink2 ghi`"
{:ok, ast, []} = Earmark.as_ast(markdown)
EarmarkHashedLink.add_hashed_link(ast) |> Earmark.Transform.transform() |> IO.puts()
# <p>
#   abc
#   <a href="hashedLink">
#     #hashedLink
#   </a>
#    def
# <code class="inline">#hashedLink2 ghi</code></p>

LICENSE

MIT. Check the LICENSE file for more information.

You can’t perform that action at this time.