Allow ability to specify language
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 :)
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!
👋 do you accept PRs on this?
+1 would love having this feature
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
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).
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. 🤞
@feluelle Thanks a ton for your response. Feel free to test this out (see my comment above.) 🙂