-
Notifications
You must be signed in to change notification settings - Fork 8
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
Improve preview generation, matrix mentions and image support #27
Conversation
This change redesigns the interface of plugins which are now expected to provide two methods: - format_content which takes the parsed markdown content and returns a (formatted_content, preview, warnings) tuple, in which - formatted_content is a plugin-specific object, - preview is the plugin's best string representation of what a post generated by it would look like - warnings is a string of any plugin-specific warning messages that were produced during processing of the content - create_post which takes the formatted_content generated by format_content and submits it as a post to the respective platform; returns a success, link tuple, where success can be true or false, and link is a link to the generated post on the platform or None if no link is available Matrix mentions are now formatted much more according to the matrix specs (including the mentioned user's display name if it can be found) and will now display correctly in at least two clients (element and nheko). Likewise, images are now uploaded in a format compatible with both of these clients.
This commit updates the dependencies in the `requirements.txt` file. It also updates the GitHub Actions workflows (`preview.yml` and `publish_content.yml`) to use the latest versions of the `actions/checkout` and `actions/setup-python` actions. The Python version in the workflows is updated to `3.12` (this was necessary for using `asyncio.Runner()`) . These changes aim to improve the overall functionality and compatibility of the project.
@wm75 Thank you. This is a great idea. I have rewritten the BlueSky and Slack plugins with the same functionality. |
Oh, hadn't thought of that, thanks for catching it! and thanks for all the other work, I'll take a look now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works very well, thanks @arash77!
... and feel free to approve and merge |
This change redesigns the interface of plugins which are now expected to provide two methods:
format_content
which takes the parsed markdown content and returns a (formatted_content, preview, warnings) tuple, in which
create_post
which takes the formatted_content generated by format_content and submits it as a post to the respective platform;
returns a success, link tuple, where success can be true or false, and link is a link to the generated post on the platform or None if no link is available
Matrix mentions are now formatted much more according to the matrix specs (including the mentioned user's display name if it can be found) and will now display correctly in at least two clients (element and nheko). Likewise, images are now uploaded in a format compatible with both of these clients.
This is still incomplete as I haven't rewritten the bluesky, linkedin and slack plugins (which I cannot test) yet, but I hope the code and description are clear enough that you can complete the work @arash77 ?