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

Switch markdown from blackfriday to goldmark #1267

Merged
merged 1 commit into from
Dec 16, 2022

Conversation

autumnull
Copy link
Contributor

Description

This pull request fixes certain markdown rendering issues by changing the rendering backend from blackfriday to goldmark.

Closes #1240

Checklist

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

@tsmethurst
Copy link
Contributor

This looks great!! @blackle and @illfygli do you have any comments? Tagging you both because you've worked in these parts of the code :)

@blackle
Copy link
Contributor

blackle commented Dec 15, 2022

looks pretty good! I can't remember the issue I fixed, but I did add a test case for it. If all the tests are still passing, then I'm good with it.

@illfygli
Copy link
Contributor

Looks good and cool, this is what I was wishing for on matrix when I did the hashtag stuff!

@autumnull
Copy link
Contributor Author

@blackle i think ur talking about #783 and yeah it still passes! because of the fact that i made dedicated inline parsers for hashtags and mentions so they only get converted where any other inline markdown would be valid (i.e. not in code blocks).

there's also #789 which this PR doesn't fix. but i'll comment more on that issue itself if this gets merged cos i have notes.

@tsmethurst tsmethurst merged commit eb08529 into superseriousbusiness:main Dec 16, 2022
@igalic
Copy link
Contributor

igalic commented Dec 16, 2022

how does this new markdown library deal with handles of the form: @_foo_@example.com?

glitch-soc has trouble with this: glitch-soc/mastodon#1464

@autumnull
Copy link
Contributor Author

autumnull commented Dec 16, 2022

@igalic mentions and hashtags now have dedicated inline parsers, so any underscores appearing in hashtags or mentions cannot be interpreted by any other inline parser. they're parsed on a first-seen basis, so once the @ sign is seen then it catches everything up until the end of the mention.

In fact this applies even when the mention doesn't reference a known user, as long as it matches the mention regex. It will shield anything from markdown parsing if it looks like a mention.

e.g. the status @_foo_@example.com renders as

<p>@_foo_@example.com</p>

if the user is not known.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] ASCII hearts get removed from markdown posts </3
5 participants