diff --git a/rebar.config b/rebar.config index 8d4c679..3e251ef 100644 --- a/rebar.config +++ b/rebar.config @@ -21,8 +21,8 @@ %% == Dependencies == {deps, [ - {earmark, {elixir, "earmark" ,"1.2.0"}}, - {worker_pool, "2.2.3"} + {worker_pool, "2.2.3"}, + {emarkdown, "0.1.0"} ]}. %% == Profiles == @@ -88,20 +88,4 @@ {base_plt_prefix, "sheldon"} ]}. -%% == Plugins == -{plugins, [ - { rebar3_elixir_compile, ".*", {git, "https://github.com/barrel-db/rebar3_elixir_compile.git", {ref, "1c6c516"}}} -]}. - -{provider_hooks, [ - {pre, [{compile, {ex, compile}}]}, - {pre, [{release, {ex, compile}}]} -]}. - -{elixir_opts, - [ - {env, dev} - ] -}. - {erl_first_files, ["src/adapter/sheldon_adapter.erl"]}. diff --git a/rebar.lock b/rebar.lock index 3a282ad..bcff4b2 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,10 +1,8 @@ {"1.1.0", -[{<<"bunt">>,{elixir,"bunt","0.2.0"},2}, - {<<"credo">>,{elixir,"credo","0.7.2"},1}, - {<<"dialyxir">>,{elixir,"dialyxir","0.5.0"},1}, - {<<"earmark">>,{elixir,"earmark","1.2.0"},0}, +[{<<"emarkdown">>,{pkg,<<"emarkdown">>,<<"0.1.0">>},0}, {<<"worker_pool">>,{pkg,<<"worker_pool">>,<<"2.2.3">>},0}]}. [ {pkg_hash,[ + {<<"emarkdown">>, <<"F1310FB8EE1A488CB2E16AA4E13CB34A7B68B310222CC47BB817B52242D7337C">>}, {<<"worker_pool">>, <<"2CD7B2C289B900940297D283922D7E119C540CB8F29B5254639ABB9BFB100CAE">>}]} ]. diff --git a/src/adapter/markdown_adapter.erl b/src/adapter/markdown_adapter.erl index 9a03740..f0de6fc 100644 --- a/src/adapter/markdown_adapter.erl +++ b/src/adapter/markdown_adapter.erl @@ -30,31 +30,5 @@ -spec adapt(binary()) -> iodata(). adapt(Line) -> - {ok, Line1, _} = 'Elixir.Earmark':as_html(Line, options()), + Line1 = emarkdown:to_html(Line), html_adapter:adapt(Line1). - -%%%=================================================================== -%%% Internal Funcions -%%%=================================================================== - --spec options() -> map(). -options() -> - #{ renderer => 'Elixir.Earmark.HtmlRenderer' - , gfm => true - , breaks => false - , pedantic => false - , smartypants => false - , sanitize => false - , footnotes => false - , footnote_offset => 1 - , code_class_prefix => 'nil' - , do_smartypants => 'nil' - , do_sanitize => 'nil' - , mapper => fun 'Elixir.Earmark':'pmap'/2 - , render_code => fun 'Elixir.Earmark.HtmlRenderer':'render_code'/1 - , file => <<"">> - , line => 1 - , messages => [] - , plugins => #{} - , '__struct__' => 'Elixir.Earmark.Options' - }. diff --git a/src/sheldon.app.src b/src/sheldon.app.src index 4d756af..acaa1d5 100644 --- a/src/sheldon.app.src +++ b/src/sheldon.app.src @@ -6,8 +6,7 @@ {applications, [ kernel, stdlib, - elixir, - earmark, + emarkdown, worker_pool ]}, {modules, []}, diff --git a/test/files/markdown.md b/test/files/markdown.md index 74aabc1..2514968 100644 --- a/test/files/markdown.md +++ b/test/files/markdown.md @@ -19,14 +19,14 @@ And you can check all of our open-source projects at [inaka.github.io](http://in And you can check all of our open-source projects at [inaka.github.io](http://inaka.github.io) -this is a test with start_block blocks +this is a test with start-block blocks this line shouldn't appear -neither end_block continue here +neither end-block continue here new one -this is a huge line with *another block* start_block1 this part of the text should be -removed end_block1 here we can continue and start_block1 this is out end_block1 continue here and start_block again -and finish end_block here +this is a huge line with *another block* start-block1 this part of the text should be +removed end-block1 here we can continue and start-block1 this is out end-block1 continue here and start-block again +and finish end-block here let's test with 'hello' > < & ; diff --git a/test/sheldon_SUITE.erl b/test/sheldon_SUITE.erl index ede7dd8..2238ced 100644 --- a/test/sheldon_SUITE.erl +++ b/test/sheldon_SUITE.erl @@ -262,16 +262,16 @@ markdown_adapter(_Config) -> , #{ line_number := 16, word := "####" } , #{ line_number := 18, word := "API" } , #{ line_number := 20, word := "open-source" } - , #{ line_number := 22, word := "start_block" } - , #{ line_number := 24, word := "end_block" } + , #{ line_number := 22, word := "start-block" } + , #{ line_number := 24, word := "end-block" } , #{ line_number := 27, word := "*another" } , #{ line_number := 27, word := "block*" } - , #{ line_number := 27, word := "start_block1" } - , #{ line_number := 28, word := "end_block1" } - , #{ line_number := 28, word := "start_block1" } - , #{ line_number := 28, word := "end_block1" } - , #{ line_number := 28, word := "start_block" } - , #{ line_number := 29, word := "end_block" } + , #{ line_number := 27, word := "start-block1" } + , #{ line_number := 28, word := "end-block1" } + , #{ line_number := 28, word := "start-block1" } + , #{ line_number := 28, word := "end-block1" } + , #{ line_number := 28, word := "start-block" } + , #{ line_number := 29, word := "end-block" } , #{ line_number := 33, word := "##" } ] } = sheldon:check(MarkownFile, #{ignore_patterns => ["http://"]}), @@ -289,14 +289,14 @@ markdown_adapter(_Config) -> , #{ line_number := 18, word := "API" } , #{ line_number := 20, word := "open-source" } , #{ line_number := 20, word := "inaka.github.io" } - , #{ line_number := 22, word := "start_block" } - , #{ line_number := 24, word := "end_block" } - , #{ line_number := 27, word := "start_block1" } - , #{ line_number := 28, word := "end_block1" } - , #{ line_number := 28, word := "start_block1" } - , #{ line_number := 28, word := "end_block1" } - , #{ line_number := 28, word := "start_block" } - , #{ line_number := 29, word := "end_block" } + , #{ line_number := 22, word := "start-block" } + , #{ line_number := 24, word := "end-block" } + , #{ line_number := 27, word := "start-block1" } + , #{ line_number := 28, word := "end-block1" } + , #{ line_number := 28, word := "start-block1" } + , #{ line_number := 28, word := "end-block1" } + , #{ line_number := 28, word := "start-block" } + , #{ line_number := 29, word := "end-block" } ] } = sheldon:check(MarkownFile, #{ adapters => [markdown_adapter] }), @@ -316,16 +316,16 @@ markdown_adapter(_Config) -> ] } = sheldon:check(MarkownFile, #{ adapters => [markdown_adapter] , ignore_blocks => - [ #{ open => "^start_block$", close => "^end_block$" } - , #{ open => "^start_block1$", close => "^end_block1$" } + [ #{ open => "^start-block$", close => "^end-block$" } + , #{ open => "^start-block1$", close => "^end-block1$" } ] }), ok = sheldon:check( MarkownFile , #{ adapters => [markdown_adapter] , ignore_blocks => - [ #{ open => "^start_block$", close => "^end_block$" } - , #{ open => "^start_block1$", close => "^end_block1$" } + [ #{ open => "^start-block$", close => "^end-block$" } + , #{ open => "^start-block1$", close => "^end-block1$" } ] , ignore_words => [ "api"