Re: Permit external JSON-LD files?

On Wed, 31 Aug 2022 at 13:52, Martin Bean <martin@martinbean.co.uk> wrote:

> > As for the <link rel="alternate"> html element, I've asked Gregg kellogg
> about this in the past and he indicated this isn't supported by design as
> it would force parsers to be able to parse html.
>
> Does it not have to do that already to find a <script> tag containing
> JSON-LD data, or HTML marked up with Schema.org properties?
>

Minimally, yes. When we (Schema.org people) proposed that JSON-LD Working
Group define a way
<https://www.w3.org/TR/json-ld/#embedding-json-ld-in-html-documents> of
putting JSON-LD inside of HTML pages, this was an explicit concern that
they (including Gregg) raised. JSON(-LD) is relatively straightforward to
parse, whereas HTML in all variants is a bit of a nightmare. They didn't
want to bloat out all JSON-LD implementations with the burden of being able
to full parse HTML (including DOM, JS etc.). That work was also not
particularly aligned with browser / webplatform conversations, with lots of
server-side data-to-data usecases driving the work.

I believe where we ended up was that
https://www.w3.org/TR/json-ld/#embedding-json-ld-in-html-documents (or its
predecessor in JSON-LD 1.0, rather) would do something very constrained so
that JSON-LD could be extracted from HTML without running it through a
fully compliant HTML parser. For example I think that affected
conversations around determining base URLs.

I expect there are more details in
https://github.com/ruby-rdf/json-ld/tree/develop/lib/json/ld of how a
JSON-LD tool handles the HTML part.

Dan


>
> > On 31 Aug 2022, at 13:38, Jarno van Driel <jarnovandriel@gmail.com>
> wrote:
> >
> > As for the <link rel="alternate"> html element, I've asked Gregg kellogg
> about this in the past and he indicated this isn't supported by design as
> it would force parsers to be able to parse html.
>
>

Received on Wednesday, 31 August 2022 13:14:41 UTC