Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heex compilation warning and no syntax highlighting between 0.36 - 0.37 #2095

Closed
bcardarella opened this issue Mar 4, 2025 · 2 comments
Closed

Comments

@bcardarella
Copy link

bcardarella commented Mar 4, 2025

I'm cutting a new release of LVN and we use the heex code fence for syntax highlighting of our projects.

this hasn't been an issue in the past, but today I'm getting this warning during documentation compilation:

warning: crashed while highlighting heex snippet:

<pre><code class="heex">&lt;LiveForm
  id=&quot;my-form&quot;
  phx-change=&quot;form-changed&quot;
  phx-submit=&quot;submit&quot;
&gt;
  &lt;TextField name=&quot;username&quot;&gt;Username&lt;/TextField&gt;
  &lt;SecureField name=&quot;password&quot;&gt;Password&lt;/SecureField&gt;
  &lt;LiveSubmitButton&gt;Submit&lt;/LiveSubmitButton&gt;
&lt;/LiveForm&gt;</code></pre>
  (makeup_eex 2.0.2) lib/makeup/lexers/eex_lexer/application.ex:39: Makeup.Lexers.EExLexer.Application.dynamic_html_lexer/0
  (makeup_eex 2.0.2) lib/makeup/lexers/heex_lexer.ex:257: Makeup.Lexers.HEExLexer.lex/2
  (makeup 1.2.1) lib/makeup.ex:48: Makeup.highlight_inner_html/2
  (ex_doc 0.37.2) lib/ex_doc/doc_ast.ex:223: ExDoc.DocAST.render_code/6
  (ex_doc 0.37.2) lib/ex_doc/doc_ast.ex:181: ExDoc.DocAST.highlight_code_block/6
  (elixir 1.18.0) lib/regex.ex:808: Regex.apply_list/5
  (elixir 1.18.0) lib/regex.ex:803: Regex.apply_list/5
  (elixir 1.18.0) lib/regex.ex:809: Regex.apply_list/5

Here is the document:

<LiveForm
  id="my-form"
  phx-change="form-changed"
  phx-submit="submit"
>
  <TextField name="username">Username</TextField>
  <SecureField name="password">Password</SecureField>
  <LiveSubmitButton>Submit</LiveSubmitButton>
</LiveForm>

Did something change between 0.36 (working) to now? I haven't dug in but if there is now validation happening then that puts us out as our syntax highlighting is identical to heex but we don't validate as heex

@josevalim
Copy link
Member

The bug was in ExDoc accidentally swallowing the error message. Once that was fixed, we got this:

** (RuntimeError) The HEEx / EEx+HTML lexer requires an HTML lexer to be registered. You can do this for example by including

    {:makeup_html, "~> 1.0"}

in your project's dependencies.

So add that as a dependency and you should be good to go!

@bcardarella
Copy link
Author

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants