Skip to content

widthAdjustment: true do not exceed 1024px #207

@am29d

Description

@am29d

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:

  1. Run carbon-now with…
  2. Wait for image to download…
  3. See error
  4. Paste code to carbon.now.sh using adjustWidth true
  5. 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 :
Screenshot 2024-03-21 at 12 37 54

Output using cli
batch-cmwtfGg40t

Carbon website using --open-in-browser flag:

Screenshot 2024-03-21 at 12 42 32

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:

batch-X2QN56ETIo

Info (please complete the following information):

Code snippet
  
  

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcarbon.now.shRelated to the carbon.now.sh webappprereleaseIntegrated and usable via carbon-now-cli@nextv2.1Ships with 2.1

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions