planetscale / beam

A simple message board for your organization or project
https://planetscale.com/blog/introducing-beam
MIT License
2.06k stars 141 forks source link

feat: Show the content of a post when notifying Slack #48

Closed marissamarym closed 2 years ago

marissamarym commented 2 years ago

Closes #47

Demo

Slack notification

Screen Shot 2022-02-24 at 10 38 49 PM

Beam post

Screen Shot 2022-02-24 at 10 39 07 PM

Changes

vercel[bot] commented 2 years ago

@marissamarym is attempting to deploy a commit to the PlanetScale Team on Vercel.

A member of the Team first needs to authorize it.

jasonlong commented 2 years ago

Hi @marissamarym, thanks for taking the time to implement this and submit a PR.

For now, we'd prefer to keep the Slack notifications lightweight and simple. Would you be interested in updating your code to generate the same sort of summary snippet that is shown on the listings page? I think it's as simple as pulling the first tag out of the content.

marissamarym commented 2 years ago

Hi @marissamarym, thanks for taking the time to implement this and submit a PR.

For now, we'd prefer to keep the Slack notifications lightweight and simple. Would you be interested in updating your code to generate the same sort of summary snippet that is shown on the listings page? I think it's as simple as pulling the first tag out of the content.

Sure! I changed it so it just takes the first element and does some light filtering of the elements so it's not previewing the first H1.

Screen Shot 2022-02-24 at 10 36 43 PM

How closely should I match the listings page? I can add filters for the same elements ['p', 'ul', 'ol', 'h3', 'pre', 'img']. And should I add a Continue reading > tag when there's more content?

jasonlong commented 2 years ago

Thanks @marissamarym. I think this is great as-is.

@bogdansoare Would you mind giving this a review before merging? 🙏🏼

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/planetscale/beam/4BZJgsuj3mPefrWDpLmWrMStzwKQ
✅ Preview: https://beam-git-fork-marissamarym-main.preview.planetscale.com

bogdansoare commented 2 years ago

Hey @marissamarym. Thank you for opening this PR ❤️, adding the summary to the slack notification would be a nice addition.

The only issue that I see is in regards to the dependencies of mack, because of the usage of remark and rehype, the package size is quite big https://bundlephobia.com/package/@instantish/mack@1.1.4.

We decided not use those libraries for markdown and go for marked because of it's smaller size and speed.

It would be great if you could find an alternative that is either based on marked or something smaller in bundle size.

marissamarym commented 2 years ago

Hey @marissamarym. Thank you for opening this PR ❤️, adding the summary to the slack notification would be a nice addition.

The only issue that I see is in regards to the dependencies of mack, because of the usage of remark and rehype, the package size is quite big https://bundlephobia.com/package/@instantish/mack@1.1.4.

We decided not use those libraries for markdown and go for marked because of it's smaller size and speed.

It would be great if you could find an alternative that is either based on marked or something smaller in bundle size.

Sorry for the delay on this, our team is currently working on improving mack as well as some of our other projects to be smaller and use marked. If it works for you, we could close this PR and I'll open another when that's ready

jasonlong commented 2 years ago

@marissamarym No worries at all. Feel free to close this and open another anytime. :thumbsup:

marissamarym commented 2 years ago

We recently upgraded mack to be ~1/4 the size and it uses marked now: https://bundlephobia.com/package/@instantish/mack@1.2.0

bogdansoare commented 2 years ago

@marissamarym thanks for updating the PR to include the new version of mack, it looks good 👍