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

Allow ability to specify language #59

Closed
Samreay opened this issue Jun 17, 2020 · 7 comments
Closed

Allow ability to specify language #59

Samreay opened this issue Jun 17, 2020 · 7 comments
Labels
feature-request New feature or request feedback-needed Feedback is needed

Comments

@Samreay
Copy link

Samreay commented Jun 17, 2020

Hi team, I notice in the settings, that you cannot manually specify the language.

	// setting this manually will be ignored
	l: 'auto',

Which is frustrating, because if you are trying to extract code snippets from a markdown file, or a Jupyter notebook, or any file which doesnt have the right extension, you do not get the correct formatting. It would be great if we could specify this manually, instead of my current solution (which is to ignore the ability to take snippets, write my own code that does the snippeting and saving to a temporary file before deleting said file). I get why you may not want it in the preset or config (because that should be language agnostic), but having it as a command line argument when invoking would be great! If its already there and Ive simply missed it when reading the docs, I apologise :)

@mixn mixn added the feature-request New feature or request label Nov 12, 2020
@mixn
Copy link
Owner

mixn commented Nov 12, 2020

Hey @Samreay, sorry for the late response, I somehow completely missed this — my bad! :)

It currently indeed will be ignored when set manually.

I’m collecting feature requests, enhancements, bugs, etc. that will ship with v2 of this CLI — the list is getting longer and longer though. :) But this will most likely be part of it since it’s quite straightforward to implement.

I will update you on when v2 is out — it’ll likely take a while still though. :)

Thanks for opening and the idea!

@julianrubisch
Copy link

👋 do you accept PRs on this?

@feluelle
Copy link

+1 would love having this feature

@mixn mixn mentioned this issue Feb 6, 2023
26 tasks
@mixn
Copy link
Owner

mixn commented Apr 29, 2023

So, I’m finalizing the big v2 release and just wanted to implement this when I realized it might not be needed.

Specifying a language will work out of the box in v2 by using "language": "YOUR_DESIRED_LANGUAGE" e.g., "language": "clojure" inside one of your presets. But it‘s completely optional and you never get asked for it via --interactive.

The question now is, is that enough? I feel like it’s definitely sufficient and solves this problem. The only “overhead” on the user’s end is that it is bound to a preset, aka. it won’t work without a preset that has an associated language key.

Example preset that will work with v2 and use TypeScript as a language:

"verminal": {
  "theme": "verminal",
  "backgroundColor": "#F30C96",
  "windowTheme": "bw",
  "windowControls": true,
  "fontFamily": "Anonymous Pro",
  "fontSize": "18px",
  "lineNumbers": false,
  "firstLineNumber": 1,
  "dropShadow": false,
  "language": "application/typescript",
  "selectedLines": "*",
  "dropShadowOffsetY": "20px",
  "dropShadowBlurRadius": "68px",
  "widthAdjustment": true,
  "lineHeight": "133%",
  "paddingVertical": "30px",
  "paddingHorizontal": "30px",
  "squaredImage": false,
  "watermark": false,
  "exportSize": "2x",
  "type": "png"
}

If you’re unsure what language values Carbon’s site understands, they’re basically all values from extensions-map.helper.ts.

This would also work with --from-clipboard, from stdin, etc.

Generally, I’m not a big fan of adding custom command line arguments like --language for something that is 100% a Carbon option, not a carbon-now-cli option (as all existing arguments so far are.)

This potentially opens up the gate to having to add more and more options over time that are solely relevant to Carbon itself, and I’d ideally like people to continue using presets for that.

If we end up adding --language, I’m scared people might start asking for basically everything to be configurable via command line arguments.

While I definitely understand that any form of “batch processing” of hundreds or thousands of screenshots would indeed benefit from a --language flag, I feel like batch processing in itself is more of an edge case. Hence why I think/hope that setting the language in a preset will suffice.

What are your thoughts on this? Thanks in advance!

@Samreay @julianrubisch @feluelle @FrancescoSaverioZuppichini

@mixn mixn added feedback-needed Feedback is needed v2 labels May 10, 2023
@feluelle
Copy link

feluelle commented May 12, 2023

For my use-case the preset is sufficient. Thank you! :)

I agree. I would not start adding carbon args as carbon-now-cli args, if not really necessary or highly requested.

I would consider this as done if v2 allows to configure it (and it is released).

@mixn
Copy link
Owner

mixn commented May 12, 2023

As I’m finalizing the huge v2 release, I’ve decided to run a small beta of it. 🙂 This issue is somehow covered in that release, so I’ll post this here. 🙂

To install the v2 beta run

npm i carbon-now-cli@beta -g

Docs 🚀 for v2 can be found here. 🙂 There are tons of new features and breaking changes, so make sure to re-read the docs if you’ve read them previously.

Happy testing and using! Looking forward to your feedback!
v2 will officially drop any day now. 🥳

P. S: I’m almost embarrassed about how long it took me to start working on v2, but at least once I did, I shipped it quite fast. 🙃 No more activity slumps in the future, though. 🤞

@mixn
Copy link
Owner

mixn commented May 12, 2023

@feluelle Thanks a ton for your response. Feel free to test this out (see my comment above.) 🙂

@mixn mixn removed the v2 label May 23, 2023
@mixn mixn closed this as completed Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request feedback-needed Feedback is needed
Projects
None yet
Development

No branches or pull requests

4 participants