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

Syndication of note appends a duplicate of a URL contained in the post content #570

Closed
sentience opened this issue Jan 3, 2023 · 6 comments · Fixed by #573
Closed

Syndication of note appends a duplicate of a URL contained in the post content #570

sentience opened this issue Jan 3, 2023 · 6 comments · Fixed by #573
Assignees
Labels
enhancement New feature or request plugin-syndicator Syndicator plug-in sponsor priority Issue opened by a Patron or Benefactor sponsor
Milestone

Comments

@sentience
Copy link
Contributor

Describe the bug

This post (as shown in the Indieweb web UI), when syndicated to Mastodon, was posted with the URL present in the post (https://kevinyank.com/) also appended to it:

{
  "html": "<p>Plenty of work still to do (especially on the home page), but my site redesign was already looking better than what was public, so I’ve merged my branch. <a href=\"https://kevinyank.com/\">https://kevinyank.com/</a> is now showing my work-in-progress redesign. #indieweb</p>",
  "text": "Plenty of work still to do (especially on the home page), but my site redesign was already looking better than what was public, so I’ve merged my branch. [https://kevinyank.com/](https://kevinyank.com/) is now showing my work-in-progress redesign. #indieweb"
}

Here's the note in my content store.

Here's the resulting Mastodon post.

Expected behaviour

I would have expected the note to be posted to Mastodon as entered into Indiekit, without the URL added to the end.

Environment

@sentience sentience added the bug Something isn't working label Jan 3, 2023
@paulrobertlloyd
Copy link
Collaborator

paulrobertlloyd commented Jan 3, 2023

This is expected behaviour, sort of! After converting Markdown to HTML, the last href (if present) is appended to the syndicated note. So if you were to post the following:

This is [my new website](https://kevinyank.com/).

this would be syndicated as:

This is my new website. https://kevinyank.com/

Your example is the one case where this approach falls apart! 🙈

I’ve noticed that Micro.blog is able to maintain linked text when it syndicates notes to Mastodon; I quickly experimented with sending HTML, but that spat out raw HTML… clearly there’s a way to send linked text over Mastodon’s API, I just need to research what is the correct means of doing so. I think that’s the solution to the above issue.

@paulrobertlloyd paulrobertlloyd added plugin-syndicator Syndicator plug-in enhancement New feature or request sponsor priority Issue opened by a Patron or Benefactor sponsor and removed bug Something isn't working labels Jan 3, 2023
@sentience
Copy link
Contributor Author

sentience commented Jan 4, 2023

For the record, I ran into this issue because I submitted a note with a URL inline, and Indiekit converted it into the Markdown link that you see above. Maybe it shouldn't do that…?

@paulrobertlloyd
Copy link
Collaborator

Oh, right. I probably have markdown-it's linkify option on - disabling that would prevent this behaviour (leaving the syndication target to do its own linkify-ing).

@sentience
Copy link
Contributor Author

In my head it could make sense for Indiekit to linkify my Markdown when converting it to HTML, but I don't expect it to modify the Markdown I give it. Unless my mental model is broken…?

@paulrobertlloyd
Copy link
Collaborator

This might be a side-effect of the change made in b64b7d4 to fix #563, released in Beta 1.

There’s a bit of to-and-fro between text and HTML representations, and Indiekit needing to account for one or both values being sent (content.text and/or content.html), or one a content value that could conceivably contain either text or HTML.

There are some tests here (that could possibly be expanded on) that account for this that may help shine a light on the different scenarios being handled:

test("Gets text and HTML values from `content` property", (t) => {

The conversion between text and html values happens here:

export const getContentProperty = (properties) => {

@paulrobertlloyd
Copy link
Collaborator

Tested syndicating this same update to my private test accounts, given the fix in #573. Here’s what this note looks like:

Mastodon

Screenshot of a post on Mastodon

Twitter

Screenshot of a status on Twitter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin-syndicator Syndicator plug-in sponsor priority Issue opened by a Patron or Benefactor sponsor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants