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

Twitter should render image of snippet when snippet url shared #237

Open
chriswedgwood opened this issue Mar 25, 2021 · 5 comments
Open
Assignees
Labels

Comments

@chriswedgwood
Copy link
Collaborator

@chriswedgwood — we should probably have a new ticket — derailing the Roadmap discussion — but 😀 — Ideally...

  • I'd share the django snippets (detail view) URL on twitter.
  • I could type my tweet.
  • If would display a nice render of the code.
  • But the key is that the link goes back to DS, where I can interact and copy the code.

For the image bit:

  • Not sure best way to generate it. Carbon is just what folks are using from this POV. Can we leverage it? Or do we do something with PIL? (It doesn't need to have every theme option and such of Carbon, if we do use PIL)
  • Not sure if we need to post the image to twitter, or can just use the OG tags. (I'd try the 2nd first, as it's clearly easier).

If I could use the same for blog posts and such — image, plus link back to editable snippet — that would cool. 🤔

I need to have a potter around Carbon to see what's possible there.

Originally posted by @carltongibson in #210 (comment)

@chriswedgwood
Copy link
Collaborator Author

@carltongibson I'll play around with whats possible as well and come up with some options.

@carltongibson
Copy link
Member

Super — thanks @chriswedgwood!

Just thinking out-loud, a one-theme option where we generate the image ourselves might be nice (part of DS is to be an example of how it's done.) Happy to input — comment here with whatever findings you make and we can discuss. 😀

@chriswedgwood
Copy link
Collaborator Author

Super — thanks @chriswedgwood!

Just thinking out-loud, a one-theme option where we generate the image ourselves might be nice (part of DS is to be an example of how it's done.) Happy to input — comment here with whatever findings you make and we can discuss. 😀

Yes we can configure a carbon theme for DS

@carltongibson
Copy link
Member

Pygment's ImageFormatter already does the hard bit.

@jefftriplett
Copy link
Member

Carbon’s API story wasn't as good as I had remembered, so Pygments is the better way to go. Plus, having a Django Snippets theme is better anyways IMO.

carbon-app/carbon#210

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

No branches or pull requests

3 participants