Aloxaf / silicon

Create beautiful image of your source code.
MIT License
3.08k stars 82 forks source link

Feature: Added a code-right-pad option and fixed highlight-lines documentation #245

Open vivaansinghvi07 opened 6 months ago

vivaansinghvi07 commented 6 months ago

This PR contains two changes.

First, a small fix in the documentation for the --highlight-lines option, as can be seen here:

/// Lines to high light. rg. '1-3; 4'

But calling this with the suggested example,

$ silicon test.py --output test.png --highlight-lines '1-3; 4'

raises the following error:

error: Invalid value for '--highlight-lines <LINES>': invalid digit found in string

The proposed change fixes this by removing the space in the string. It also fixes some typos in the documentation comment.

The second change is regarding padding to the right of the code. Sometimes, the generated code screenshot feels somewhat "squished" to me. Here's an example of a C file I tried Silicon on just for fun.

image

Here is the same code screenshot with the new --code-pad-right option set to 75 instead of the default 25.

image

It gives more of a gap on the right of the code, like how it is when normally editing code.