pragdave / earmark

Markdown parser for Elixir
Other
859 stars 135 forks source link

from_file! ignores the options if not a .eex file is passed #466

Closed bandesz closed 1 year ago

bandesz commented 1 year ago

What

I tried to disable smartypants in from_file!, but it had no affect:

Earmark.from_file!("README.md"), smartypants: false)

After looking through the code I found eventually include:

def include(filename, options \\ []) do
  options_ =
    options
    |> Options.relative_filename(filename)
  case Path.extname(filename) do
    ".eex" -> EEx.eval_file(options_.file, include: &include(&1, options_))
    _      -> SysInterface.readlines(options_.file) |> Enum.to_list
  end
end

For files other than "*.eex" the options are just ignored.

RobertDober commented 1 year ago

Thank you for your report, I am on vacation right now and might not be able to look at this in the near future therefore.

RobertDober commented 1 year ago

Still investigating cannot reprocuce the behavior

however you might want have a look at #467

./earmark tmp/xxx.md.eex                                                                                                                                         [17:00:52]
device: #PID<0.109.0>
<h1>
Hello – World</h1>

╭─>robert@aude ~/gh/elixir/earmark                                                                                           ❰1.14.5-otp-26➤26.0.1❱ [± master/3fcc7e6 ✓]
╰─> λ ./earmark tmp/xxx.md                                                                                                                                             [17:03:20]
device: #PID<0.109.0>
<h1>
Hello – World</h1>

Both are rendered with smartpants