Problem in updating 0.4.2 to 0.8.4 (Calling Phoenix custom components)
Hi, Thank you for the lib. my website is using mdex with my ui lib components. it has no problem in 0.4.2, but after updating the mdex to last version i get some errors like these
before errors my code is (it is just 2 files) https://gist.github.com/shahryarjb/6873649a811d0a270ccce84751bd2980
Errors
== Compilation error in file lib/mishka/blog.ex ==
** (Phoenix.LiveView.Tokenizer.ParseError) _build/dev/lib/mishka/priv/articles/2024-10-26-build-a-static-site-in-elixir-under-5-minutes-with-phoenix-components.md:1:291: missing opening tag for </p>
|
1 | <br/><p align="center"><img src="/images/blog/build-a-static-site-in-elixir-under-5-minutes-with-phoenix-components.png" alt="Build a Static Site in Elixir Under 5 Minutes with Phoenix Components"/></p><br/><p><.heading2>Build a Static Site in Elixir Under 5 Minutes with Phoenix Components</p><p><.cp>In this tutorial, you'll learn how to quickly build a static blog site using Elixir.
| ^
(phoenix_live_view 1.1.8) lib/phoenix_live_view/tag_engine.ex:1666: Phoenix.LiveView.TagEngine.raise_syntax_error!/3
(phoenix_live_view 1.1.8) lib/phoenix_live_view/tag_engine.ex:842: Phoenix.LiveView.TagEngine.handle_token/2
(phoenix_live_view 1.1.8) lib/phoenix_live_view/tag_engine.ex:222: Phoenix.LiveView.TagEngine.handle_body/1
lib/mishka/blog.ex:135: Mishka.Blog.MDExConverter.render_heex!/3
lib/mishka/blog.ex:73: Mishka.Blog.MDExConverter.convert/4
(nimble_publisher 1.1.1) lib/nimble_publisher.ex:78: anonymous fn/5 in NimblePublisher.build_entry/4
(elixir 1.18.4) lib/enum.ex:1714: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.18.4) lib/enum.ex:4442: Enum.flat_map_list/2
Something changed? when i downgrade again it works
Thank you in advance
Hi @shahryarjb !
Yep I do remember that code :)
Please give this a try: https://gist.github.com/leandrocp/d63df13712393af61807a9cbe306ee98
- Fixed
unescape/1 - Updated
optsunsafe_can beunsafenow- Disabled syntax highlighting with
syntax_highlight: nil
Example:
MDEx.to_html!("""
# No Syntax Highlighting
```elixir
@foo :bar
```
# Raw HTML
<div>foo</div>
""",
render: [unsafe: true],
syntax_highlight: nil)
|> IO.puts()
# <h1>No Syntax Highlighting</h1>
# <pre><code class="language-elixir">@foo :bar
# </code></pre>
# <h1>Raw HTML</h1>
# <div>foo</div>
That gist is mostly a workaround but I'll be working on proper built-in Phoenix tags support soon to make it more reliable.
Hello dear @leandrocp , Thank you for your response. 🙏🏻♥️ Unfortunately, I'm still encountering some other errors, so I think it's better to wait for the next update when this feature is hopefully added to the library.
I really appreciate your efforts, you've built an excellent library. 📚 In fact, the blog post I created titled "Create a blog in 5 minutes" (which I taught using your library) has become the third most visited link on my site 💰. Lately, I've been using your library for most of the content I publish, and it gives me full access to all the components in my own library.
Thanks again!