1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
defmodule ExDoc.ShellLexer do
# Makeup lexer for sh, bash, etc commands.
# The only thing it does is making the `$ ` prompt not selectable.
@moduledoc false
@behaviour Makeup.Lexer
@impl true
def lex(text, _opts) do
text
|> String.split("\n")
|> Enum.flat_map(fn
"$ " <> rest ->
[
{:generic_prompt, %{selectable: false}, "$ "},
{:text, %{}, rest <> "\n"}
]
text ->
[{:text, %{}, text <> "\n"}]
end)
end
@impl true
def match_groups(_arg0, _arg1) do
raise "not implemented yet"
end
@impl true
def postprocess(_arg0, _arg1) do
raise "not implemented yet"
end
@impl true
def root(_arg0) do
raise "not implemented yet"
end
@impl true
def root_element(_arg0) do
raise "not implemented yet"
end
end
|