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

Allow parsing tag with namespace? #112

Open
ioquatix opened this issue May 19, 2020 · 5 comments
Open

Allow parsing tag with namespace? #112

ioquatix opened this issue May 19, 2020 · 5 comments

Comments

@ioquatix
Copy link

It looks like this can't parse a tag with a namespace, e.g. <foo:bar ...>

md4c/src/md4c.c

Lines 999 to 1004 in 25096c7

/* Tag name */
if(off >= line_end || !ISALPHA(off))
return FALSE;
off++;
while(off < line_end && (ISALNUM(off) || CH(off) == _T('-')))
off++;

Can we allow it to parse tags with namespaces? i.e. allow : in the tag name.

@mity
Copy link
Owner

mity commented May 19, 2020

Indeed, it cannot.

  1. It's exactly as CommonMark specification requests, I believe. As such, all compliant implementations won't recognize it.

  2. Generally, the raw HTML support in Markdown/Commonmark is simplified.

  3. Also, I'm not expert in this, but it's more XML rather than HTML thing, isn't it? But I admit, allowing XML tags might have a similar merit as HTML tags.

Given all that together, it would be imho best if you can open an issue in the CommonMark spec repo.

@ioquatix
Copy link
Author

Yes, I've made a proposal here: commonmark/commonmark-spec#648

Regarding 3, we already support namespaced attributes, so one might consider it an oversight that namespaced tags are not also supported.

@craigbarnes
Copy link
Contributor

craigbarnes commented Jun 26, 2020

... it's more XML rather than HTML thing, isn't it?

Yes. There's no such thing as a "tag with a namespace" in HTML. The "tag name" tokenizer state consumes everything except [\0\t\n\f />] as part of the basic tag name.

@ioquatix
Copy link
Author

@craigbarnes does that mean a tag name state can parse <foo:bar/> with a tag name of foo:bar?

@craigbarnes
Copy link
Contributor

craigbarnes commented Jun 26, 2020

@craigbarnes does that mean a tag name state can parse <foo:bar/> with a tag name of foo:bar?

Yes, but foo is not a "namespace" (in the XML sense) when parsed as HTML. Namespace prefixes have specific semantics in XML/XHTML, whereas in HTML it just becomes part of the element name.

All elements in a HTML DOM tree have a namespace, but it's determined by what nodes are higher up in the tree (e.g. <svg>) rather than explicitly in the markup.

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

No branches or pull requests

3 participants