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

Support for <meta itemprop=...> of Schema.org Semantic/Microdata Markup #527

Closed
ilyaigpetrov opened this Issue Jun 11, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@ilyaigpetrov

ilyaigpetrov commented Jun 11, 2018

There are some approaches to semantic markup, one of them is Schema.org and its microdata.
Here is an example:

This paragraph is closed right after an opening span:
<span itemprop="contentLocation" itemscope itemtype="https://schema.org/City">
  <meta itemprop="name" content="Springfield">
  <span itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
    <meta itemprop="addressCountry" content="US">
    <span itemprop="addressLocality">Springfield</span>,
    <span itemprop="addressRegion">Oregon</span>
    <meta itemprop="postalCode" content="97477">
  </span>
</span>

As you can see <meta> is used to convey semantic data, more examples of how <meta> is used may be found here on Schema.org.
You may view this snippet on Dingus (copy-paste URL if doesn't work), output of CommonMark is the following:

<p>This paragraph is closed right after an opening span:
<span itemprop="contentLocation" itemscope itemtype="https://schema.org/City"></p>
  <meta itemprop="name" content="Springfield">
  <span itemprop="address" itemscope itemtype="https://schema.org/PostalAddress">
    <meta itemprop="addressCountry" content="US">
    <span itemprop="addressLocality">Springfield</span>,
    <span itemprop="addressRegion">Oregon</span>
    <meta itemprop="postalCode" content="97477">
  </span>
</span>

As you can see the first opening <span> is wrapped into <p> by CommonMark, because:

this accords with the spec (sec. 4.6): commonmark treats the
line with the meta tag as starting a type-6 HTML block, so the preceding
paragraph is closed.

As I read the HTML5 spec
https://www.w3.org/TR/html/document-metadata.html#the-meta-element
it says that meta elements are allowed only in a head
element, with the following exception: if the name
attribute is present, they are allowed “where metadata
content is expected.”

...the example from schema.org that you
link to doesn’t have a name element. Instead, it has
itemprop. The HTML5 spec for meta says:
“Exactly one of the name, http-equiv, and charset
attributes must be specified.” So, I guess this is not
valid HTML5. It might be valid HTML4.

We want to be pragmatic about this, so if this use of
meta tags is common, we should probably exclude the
meta tag from the list of tags in #6 of section 4.6 of
the spec, allowing them to appear as inline content.
Would anyone have objections to this?

All quotations are by @jgm from talk.commonmark.org.

@jgm jgm closed this in cb136a4 Jun 11, 2018

jgm added a commit to commonmark/cmark that referenced this issue Jun 11, 2018

jgm added a commit to commonmark/commonmark.js that referenced this issue Jun 11, 2018

jgm added a commit to jgm/commonmark-hs that referenced this issue Jun 11, 2018

@ilyaigpetrov

This comment has been minimized.

ilyaigpetrov commented Jun 12, 2018

Thank you!
Will the dingus be updated so I can show it to markdown-it developers?

@jgm

This comment has been minimized.

Member

jgm commented Jun 12, 2018

kivikakk added a commit to github/cmark-gfm that referenced this issue Jun 20, 2018

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