carbon-now-cli
carbon-now-cli copied to clipboard
`widthAdjustment: true` do not exceed 1024px
Describe the bug
When I try to generate image with a long code line, the output image is fixed to 1024p for 1x
and 2048p for 2x
output size.
To Reproduce Steps to reproduce the behavior:
- Run
carbon-now
with… - Wait for image to download…
- See error
- Paste code to carbon.now.sh using adjustWidth true
- The image is in full width without line breaks
** Code I am using **
import { BatchProcessor, EventType, processPartialResponse, } from '@aws-lambda-powertools/batch';
import type { SQSEvent, SQSRecord, Context, SQSBatchResponse } from 'aws-lambda';
const processor = new BatchProcessor(EventType.SQS);
const recordHandler = async (record: SQSRecord): Promise<void> => {
const payload = record.body;
};
export const handler = async (
event: SQSEvent,
context: Context
): Promise<SQSBatchResponse> => {
return processPartialResponse(event, recordHandler, processor, {context});
};
Configuration json file for the cli
{
"latest-preset": {
"theme": "night-owl",
"backgroundColor": "#161E2D",
"dropShadows": false,
"exportSize": "1x",
"firstLineNumber": 1,
"fontFamily": "Hack",
"fontSize": "18px",
"language": "auto",
"lineHeight": "133%",
"lineNumbers": true,
"selectedLines": "*",
"squaredImage": false,
"type": "png",
"watermark": false,
"widthAdjustment": true,
"windowControls": false,
"windowTheme": "none"
}
}
Expected behavior I expect the tool to not break the line and take as much with as necessary
Screenshots
Carbon website manually :
Output using cli
Carbon website using --open-in-browser
flag:
Edit: I tried to reduce the fontSize
to 14 or 12, but the results are still ab bit weird, but the width seems to be correct:
Info (please complete the following information):
- OS [e.g. macOS, Linux, Windows, iOS]: macOS
-
--engine
used [e.g.chromium
,firefox
,webkit
]: all engines produce the same output - Carbon URL (run with
--open-in-browser
to see) [e.g. carbon.now.sh?bg=pink]: https://carbon.now.sh/?bg=%23161E2D&code=import%2520%257B%2520BatchProcessor%252C%2520EventType%252C%2520processPartialResponse%252C%2520%257D%2520from%2520%27%2540aws-lambda-powertools%252Fbatch%27%253B%250Aimport%2520type%2520%257B%2520SQSEvent%252C%2520SQSRecord%252C%2520Context%252C%2520SQSBatchResponse%2520%257D%2520from%2520%27aws-lambda%27%253B%250A%250Aconst%2520processor%2520%253D%2520new%2520BatchProcessor%28EventType.SQS%29%253B%250A%250Aconst%2520recordHandler%2520%253D%2520async%2520%28record%253A%2520SQSRecord%29%253A%2520Promise%253Cvoid%253E%2520%253D%253E%2520%257B%250A%2520%2520const%2520payload%2520%253D%2520record.body%253B%250A%257D%253B%250A%250Aexport%2520const%2520handler%2520%253D%2520async%2520%28%250A%2520%2520event%253A%2520SQSEvent%252C%250A%2520%2520context%253A%2520Context%250A%29%253A%2520Promise%253CSQSBatchResponse%253E%2520%253D%253E%2520%257B%250A%2520%2520return%2520processPartialResponse%28event%252C%2520recordHandler%252C%2520processor%252C%2520%257Bcontext%257D%29%253B%250A%257D%253B&dropShadows=false&ds=false&dsblur=68px&dsyoff=20px&es=1x&fl=1&fm=Hack&fs=18px&l=auto&lh=133%25&ln=true&ph=32px&pv=48px&si=false&sl=%2A&t=night-owl&type=png&wa=true&wc=false&wm=false&wt=none
Code snippet
Hey @am29d, thanks for opening. Been quite swamped since the beginning of the year, but I will tackle a new release of the CLI soon and, amongst other things, address this (somehow.) 🙂 Thanks for your patience, appreciated!
Bump... :) I have the same problem. It seems odd that it introduces unnecessary line breaks.
Turns out, width
is an undocumented option for carbon-now.json
. I only discovered it because I exported the config from carbon.now.sh. You should add this to the documentation.
Any update on this?