#1606·carbon

Code lines overlap/merge together upon image generation

Author: HUMANCODERMJCreated Jun 13, 2026Updated Aug 13, 2026
Labelsbug

Bug Report: Text overlapping issue when exporting Python code

Describe the bug When using Carbon (carbon.now.sh) to export images or copy snippets containing Python code, specific lines of code, particularly those involving object attribute assignment or method calls like app.state.db = mongodb_client.get_database("my_nosql_db"), result in text overlapping and rendering irregularities in the final output. This appears to be specific to the Python language syntax rendering within the tool.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://carbon.now.sh/
  2. Select 'Python' from the language dropdown menu.
  3. Paste or write a line of code such as app.state.db = mongodb_client.get_database("my_nosql_db").
  4. Click 'Export' to generate an image or use the 'Copy Image/Code' function.
  5. Observe that the text in the generated output is overlapped and visually corrupted.

Expected behavior The generated image or copied code should display the Python code clearly with proper character spacing, without any text overlapping or rendering artifacts, regardless of the line length or specific method syntax.

Screenshots Image

  • OS: Windows
  • Browser: Chrome
  • Carbon URL: URL
@asynccontextmanager
async def lifespan(app: FastAPI):
# 1. Initialize the native PyMongo Async Client
mongodb_client = AsyncMongoClient(
"mongodb://user:password@localhost:27017/",
maxPoolSize=50,
minPoolSize=10,
maxIdleTimeMS=60000
)
# 2. Attach the database to the app state
app.state.db = mongodb_client.get_database("my_nosql_db")

yield # App runs here

# 3. Clean up on shutdown
await mongodb_client.close()
print("MongoDB connection closed.")