Skip to content

markdown resources cannot be identified because CSS cloaks them as HTML #1021

Closed

Description

@angelo-v

CSS renders markdown files as HTML, which is very convenient when shown in web browsers, but currently makes it impossible for generic data browsers to know that a given resource is actually markdown canonically.

NSS (besides not doing the conversion) adds a triple like that to the container resource:

<file.md>
    a <http://www.w3.org/ns/iana/media-types/text/markdown#> .

But CSS does not. There should be a way for clients to know, that a given HTML resource has a canonical markdown representation. Perhaps CSS can include it as a Link header or HTML meta information and into the container as NSS does.

Practical consequences today are e.g. that the markdown-pane will not show up on CSS, because the data browser only receives HTML content.

Activity

  1. RubenVerborgh commented on Oct 22, 2021

    @RubenVerborgh
    Member

    but currently makes it impossible for generic data browsers to know that a given resource is actually markdown canonically.

    Yes, just send a request to it with an Accept: */*.

    adds a triple like that to the container resource:

    There is an ongoing discussion about that here: solid/specification#227
    but basically, we cannot say for all resources X what their content type is, because they can be represented in multiple content types. For example, if the backend is a SPARQL endpoint, then is an RDF document Turtle? All we know is that we can represent it as triples.

  2. angelo-v commented on Oct 22, 2021

    @angelo-v
    ContributorAuthor

    Yes, just send a request to it with an Accept: */*.

    hmm, not really:

    ▶ curl -I -H Accept:"*/*" https://solidweb.me/aveltens/README          
    HTTP/2 200 
    content-type: text/html
    

    Being explicit works:

    ▶ curl -I -H Accept:"text/markdown" https://solidweb.me/aveltens/README
    HTTP/2 200 
    content-type: text/markdown
    

    Even heavily preferring markdown over html does not work 😱

    ▶ curl -I -H Accept:"text/markdown;q=0.9, text/html;q=0.1" https://solidweb.me/aveltens/README
    HTTP/2 200 
    content-type: text/html
    

    but basically, we cannot say for all resources X what their content type is, because they can be represented in multiple content types. For example, if the backend is a SPARQL endpoint, then is an RDF document Turtle? All we know is that we can represent it as triples.

    That's true of course. The question remains how can people actually manage markdown resources on their pod? Even if apps like a markdown editor just requests markdown representation, how could it know, whether it is ok to PUT it back as markdown? Users might need more control which representation format they want to use to read and write. Currently, from a users perspective, CSS just "messes up" the markdown files I put there.

  3. RubenVerborgh commented on Oct 22, 2021

    @RubenVerborgh
    Member

    Yes, just send a request to it with an Accept: */*.

    hmm, not really:

    I was just testing it and saw the same; I think that's a bug.

    The question remains how can people actually manage markdown resources on their pod?

    When this bug is fixed 🙂 Lemme look into it.

  4. RubenVerborgh commented on Oct 22, 2021

    @RubenVerborgh
    Member

    Following up in #1023

    The reason I expected it to work, is because the same conversion is not forced for errors:

    curl http://localhost:3000/404 -i -s | grep -i Content-Type

    and we are using the same mechanism for both.

  5. RubenVerborgh commented on Oct 22, 2021

    @RubenVerborgh
    Member

    Apparently this was a known bug: #834

  6. RubenVerborgh commented on Oct 22, 2021

    @RubenVerborgh
    Member
  7. jvherweg commented on Nov 8, 2021

    @jvherweg
    Member

    Done in #1030. Will be part of v3.0.0 release.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions