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

"content" field is markdown but is advertised as HTML #1871

Closed
lanodan opened this issue Oct 29, 2021 · 9 comments
Closed

"content" field is markdown but is advertised as HTML #1871

lanodan opened this issue Oct 29, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@lanodan
Copy link

lanodan commented Oct 29, 2021

This was seen in #1220.

Currently in lemmy, the content field contains markdown which is tolerable but sadly it's advertised as text/html.

$ curl -s -H 'Accept: application/activity+json' https://ds9.lemmy.ml/comment/2207 | jq . 
{
  "@context": [
    "https://www.w3.org/ns/activitystreams",
    {
      "sensitive": "as:sensitive",
      "pt": "https://join-lemmy.org#",
      "sc": "http://schema.org#",
      "stickied": "as:stickied",
      "moderators": "as:moderators",
      "comments_enabled": {
        "type": "sc:Boolean",
        "id": "pt:commentsEnabled"
      },
      "matrixUserId": {
        "type": "sc:Text",
        "id": "as:alsoKnownAs"
      }
    },
    "https://w3id.org/security/v1"
  ],
  "type": "Note",
  "id": "https://ds9.lemmy.ml/comment/2207",
  "attributedTo": "https://ds9.lemmy.ml/u/lanodan",
  "to": [
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "content": "Formatting test.\n\n#hashtag ?\n\n- zero\n- *one*\n- **two**\n- ***three***\n- ****four****\n- *****five*****\n\n~~strike~~\n\n> quote\n\n`code`\n\n```\ncode\nblock\n```\n\nCO~2~\nEMC^2^\n\n\n::: spoiler details\ncontent\n:::\n\n\n# h1\n## h2\n### h3\n#### h4",
  "mediaType": "text/html",
  "source": {
    "content": "Formatting test.\n\n#hashtag ?\n\n- zero\n- *one*\n- **two**\n- ***three***\n- ****four****\n- *****five*****\n\n~~strike~~\n\n> quote\n\n`code`\n\n```\ncode\nblock\n```\n\nCO~2~\nEMC^2^\n\n\n::: spoiler details\ncontent\n:::\n\n\n# h1\n## h2\n### h3\n#### h4",
    "mediaType": "text/markdown"
  },
  "inReplyTo": "https://ds9.lemmy.ml/comment/2206",
  "published": "2021-10-29T18:56:56.678095+00:00"
}
@lanodan lanodan added the bug Something isn't working label Oct 29, 2021
@Nutomic
Copy link
Member

Nutomic commented Nov 1, 2021

Thanks for finding this. Will definitely fix it before 0.14. If markdown is tolerable for you thats great, then i will just set mediatype markdown, put markdown in content and get rid of the source field.

@lanodan
Copy link
Author

lanodan commented Nov 1, 2021 via email

@Nutomic
Copy link
Member

Nutomic commented Nov 1, 2021

Alright, then i will just fix the html conversion.

@dessalines
Copy link
Member

Just a note, but if there's something we're doing that's not commonmark, then we need to open up an issue on are markdown parser, markdown-it, which should follow the commonmark spec.

@lanodan
Copy link
Author

lanodan commented Nov 2, 2021 via email

@lanodan
Copy link
Author

lanodan commented Nov 3, 2021 via email

@Nutomic
Copy link
Member

Nutomic commented Nov 4, 2021

That is because we use two different libraries for markdown rendering. One in javascript in the frontend, which supports spoiler tags, and another one in the backend in Rust which apparently doesnt.

So we should probably open an issue about it in the comrak repo. @dessalines Do you know if there is some documentation/specification for this spoiler syntax?

@dessalines
Copy link
Member

The spoiler tag is the only thing that's not CommonMark, and its totally custom so I wouldn't expect anything else to support it. It's using markdown-it custom containers: https://github.com/markdown-it/markdown-it-container

@Nutomic
Copy link
Member

Nutomic commented Nov 8, 2021

I opened a separate issue about the spoiler tag #1884

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants