-
Notifications
You must be signed in to change notification settings - Fork 663
Error: Unrecognized Tag
Not expecting a tag? If you're writing text at the root of a template, remember, Marko starts in concise mode and any text not prefixed with
--will be parsed as a tag declaration.
When Marko encounters an unrecognized tag at compile-time it will throw an error by default. For example:
[template.marko:0:1] Unrecognized tag: invalid-tag
Marko will only discover tags from packages that are listed as dependencies or devDependencies in your package.json file. If the tag name looks correct, please make sure you have the package installed and listed.
While throwing on unrecognized tags allows Marko to catch potential problems as early as possible, it does require that Marko be aware of all of the possible tag names (including tag names for standard HTML elements, Marko UI components and custom HTML elements).
For tags you wish to explicitly pass through as is, such as web components, you can provide Marko with a hint via an html-elements.json file. To register the custom element create a html-elements.json in the same directory or a higher up directory and register the tag as shown below.
src/components/hello/index.marko:
<amp-app-banner layout="nodisplay" id="demo-app-banner-2134">src/html-elements.json:
{
"<amp-app-banner>": {}
}With that change in place, the Marko compiler will not complain that the <my-custom-element> tag is unrecognized and instead output the tag as if it was a regular html tag.
To automatically fix deprecated marko syntax, try the marko migrate command from the CLI.