Skip to content

Support custom HTML element tags in template syntax #691

@ankhers

Description

@ankhers

Describe the bug
I am attempting to include the @tailwindplus/elements package. This will give me a handful of custom HTML elements that I can use to build my application. At least some of the custom elements have the - character in the name. e.g., <el-dialog>. Full error below

== Compilation error in file lib/my_app_web/main_layout.ex ==
** (Hologram.TemplateSyntaxError)

Reason:
Unknown reason.

Hint:
Please report that you received this message here: https://github.com/bartblast/hologram/issues
and include a markup snippet that will allow us to reproduce the issue.

ss="h-full">\n    <el-dialog></el-dialog>\n
                     ^

status = :start_tag

token = {:symbol, "-"}

context = %Hologram.Template.Parser.Context{attribute_name: nil, attribute_value: [], attributes: [], block_name: nil, delimiter_stack: [], node_type: :tag, prev_status: :start_tag_name, processed_tags: [{:text, "\n    "}, {:start_tag, {"body", [{"class", [text: "h-full"]}]}}, {:text, "\n  "}, {:end_tag, "head"}, {:text, "\n  "}, {:self_closing_tag, {"Runtime", []}}, {:text, "\n    "}, {:end_tag, "title"}, {:text, "My App"}, {:start_tag, {"title", []}}, {:text, "\n    "}, {:self_closing_tag, {"meta", [{"name", [text: "csrf-token"]}, {"content", [expression: "{Phoenix.Controller.get_csrf_token()}"]}]}}, {:text, "\n    "}, {:self_closing_tag, {"meta", [{"name", [text: "viewport"]}, {"content", [text: "width=device-width, initial-scale=1"]}]}}, {:text, "\n    "}, {:self_closing_tag, {"meta", [{"charset", [text: "utf-8"]}]}}, {:text, "\n    "}, {:start_tag, {"head", []}}, ...], ...}

    (hologram 0.6.6) lib/hologram/template/parser.ex:1064: Hologram.Template.Parser.raise_error/5
    (hologram 0.6.6) lib/hologram/template.ex:22: Hologram.Template.dom_ast/1
    (hologram 0.6.6) lib/hologram/template.ex:40: Hologram.Template.build_holo_sigil_ast/1
    (hologram 0.6.6) expanding macro: Hologram.Template.sigil_HOLO/2
    (my_app 0.1.0) lib/my_app_web/main_layout.ex:7: MyAppWeb.MainLayout.template/0

Reproduction Repository
Please provide a link to a minimal reproduction repository forked from Hologram Skeleton: https://github.com/bartblast/hologram_skeleton
Repository URL:
Not including a repo as this is not specific to my setup. I can create one if need be.

To Reproduce
Steps to reproduce the behavior:

  1. Include a - character in any HTML element

Expected behavior
https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#using_a_custom_element -- This should be valid.

Screenshots
N/A

Environment information

  • Hologram version: 0.6.6
  • Elixir version: 1.19.5
  • Erlang/OTP version: 28
  • Node.js version: 24.13.0
  • Operating System: NixOS 25.11
  • Browser (if applicable):

Additional context
N/A

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions