microdotblog / sunlit

Publish photos to your own blog — hosted by Micro.blog or compatible blogs using WordPress or Micropub — and discover beautiful photos from other users.
https://sunlit.io
MIT License
50 stars 7 forks source link

Idea: Send separate content.html and content.value content properties #112

Closed paulrobertlloyd closed 4 years ago

paulrobertlloyd commented 4 years ago

Rather than default to HTML, provide both content.html and content.value when sending a Micropub request. For example:

"content": [{
    "html":"<p>Tuneresque</p><p><img src=\"https://getindiekit.github.io/sandbox/media/photos/2020/08/30/8u53c.jpg\" width=\"600\" height=\"839\" alt=\"Dramatic sunset over Brighton’s West Pier\" style=\"height: auto;\" class=\"sunlit_image\" /></p>",
    "value":"Tuneresque\n\n![Dramatic sunset over Brighton’s West Pier](https://getindiekit.github.io/sandbox/media/photos/2020/08/30/8u53c.jpg)"
}]

content.html can provide the content as HTML (with width, class and other attributes on the img), while context.value could provide a simpler representation, using Markdown for image references. That said, I’m unclear if Markdown is considered valid for content.value.

In #86, @manton responded:

I don't think it's clear how best to handle this, because passing separate Markdown-only text (without any HTML tags) will lose some data since Markdown image references can't have width/height/class. So I'm leaning to not changing this for now until there's more feedback from other Micropub implementations. We always recommend that people enable Markdown processing for anything posted from Micro.blog or Sunlit.

cheesemaker commented 4 years ago

Do we need to consider this at all or is #100 a good compromise here?

paulrobertlloyd commented 4 years ago

Happy to test this out when 3.2 arrives in TestFlight. Ultimately, I’d like Sunlit to provide a less opinionated syntax than the default HTML it currently provides, and it seems Markdown might be one way of achieving that, but I’m not sure.

manton commented 4 years ago

I think we should keep the current behavior, HTML-only for multiple sections. We can reconsider later but I think simpler (one format) is better here.