Skip to content

FEAT: Add custom symbol style and custom code block language#491

Open
caupolicanre wants to merge 30 commits intoanmol098:masterfrom
caupolicanre:master
Open

FEAT: Add custom symbol style and custom code block language#491
caupolicanre wants to merge 30 commits intoanmol098:masterfrom
caupolicanre:master

Conversation

@caupolicanre
Copy link

Hi! Yesterday, I was implementing this action on my personal README and instantly thought about 2 cool features that I'd like in this action. So first I made an issue requesting a new symbol to be added #489, but then forked the repo and started programming them by myself.

This PR has 2 new features:

  • Custom symbol style
  • Custom code block language

Custom Symbol Style

This feature allows the user to enter 2 symbols of their choice to customize their progress bars.

Created a new environment variable SYMBOL_STYLE where the flag can be set to "▰▱" (just an example) to change the style of progress bar (by default is empty). If the length of the string is not 2, the default symbol version will be used.
Then changed the logic to:

    if len(EM.SYMBOL_STYLE) == 2:
        done_block, empty_block = EM.SYMBOL_STYLE[0], EM.SYMBOL_STYLE[1]   
    else:
        done_block, empty_block = Symbol.get_symbols(EM.SYMBOL_VERSION)

So if there are 2 symbols in "SYMBOL_STYLE" it will use them, if not, will use "SYMBOL_VERSION".

Custom Code Block Language

This feature allows the user to enter the programming language of their choice to customize their code blocks.

Created a new environment variable CODE_BLOCK_LANGUAGE where the flag can be set to "python" (just an example) to change the language of code blocks (by default is "text"). Here is a list of the language code blocks supported by github. I preferred to simply add the link to the list of languages to the README, and not write it, so that it is not so long.
A verification can be added if you want. It could be an if statement to check if "CODE_BLOCK_LANGUAGE" is in the available languages list.

Example

Everything was tested in my personal repository.
Here is an example of my personal README where I'm using a custom symbol and python language for the code block:
image

I added the new documentation to the README explaining the two new environment variables.

I remain attentive for any questions.
Caupo.

@anmol098 anmol098 self-requested a review December 4, 2023 02:42
@anmol098
Copy link
Owner

anmol098 commented Dec 4, 2023

Great addition.
I'll have a look once and merge

Copy link
Collaborator

@aravindvnair99 aravindvnair99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caupolicanre could you undo the formatting changes? Especially the one to action.yml

@caupolicanre
Copy link
Author

caupolicanre commented Dec 4, 2023

@caupolicanre could you undo the formatting changes? Especially the one to action.yml

@aravindvnair99 I don't know why it shows a complete change on the whole file, I didn't change the formatting of it.
Just added the 2 new environment variables SYMBOL_STYLE and CODE_BLOCK_LANGUAGE on these lines.

I don't know if there is a way to go back to a previous version of the file in github (before the fork) and try adding again those lines. If there is a way to do that, let me know and I'll change it.

EDIT: Just used these commands to restore original action.yml in this commit:

git fetch upstream
git checkout upstream/master -- [action.yml]

Then added the 2 new environment variables in this commit.

@caupolicanre
Copy link
Author

@anmol098 @aravindvnair99 PR is ready to review.
Already checked the requested changes and everything should be ready to merge!

I remain attentive for any questions or changes needed.
Caupo.

MarkenJaden
MarkenJaden previously approved these changes Apr 7, 2024
Copy link
Collaborator

@MarkenJaden MarkenJaden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd reeeaally like this change. Code looks good to me, I tested it on my machine.

@MarkenJaden MarkenJaden dismissed aravindvnair99’s stale review April 7, 2024 09:33

Formatting changed were rolled back but still seem to occur, I'm also not sure why this happens, but it's working fine. I think this change can be dismissed.

@caupolicanre
Copy link
Author

I'd reeeaally like this change. Code looks good to me, I tested it on my machine.

Thank you so much for reviewing my PR! I would also love this change in the main project, but as of today, I'm using my own fork to have this enhanced version.
I look forward to the addition of this feature.

pseusys
pseusys previously approved these changes May 2, 2024
Copy link
Collaborator

@pseusys pseusys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great addition, thank you!
However, we can't merge without all the required workflows run successfully (or until @anmol098 relaxes this limitation 🌚)...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the diff in this file, I wonder, why so much?..

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the diff in this file, I wonder, why so much?..

I don't know why it shows changes in the whole file.
I just added these two new variables.

I didn't modify the format or anything else.
In this commit, I did a rollback, bringing action.yml file to it's original version.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thank you!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caupolicanre Perhaps you had an auto format enabled which is a common setting in VS Code, linting tools, etc. I see the diff is mostly whitespace changes. You can resync this file from master and reapply the changes.

@caupolicanre caupolicanre dismissed stale reviews from pseusys and MarkenJaden via 92ecd5f August 12, 2025 21:58
@github-actions github-actions bot added documentation Improvements or additions to documentation python Pull requests that update Python code labels Aug 12, 2025
@ok-coder1
Copy link
Collaborator

@caupolicanre Can you please resolve conflicts?

@ok-coder1 ok-coder1 assigned ok-coder1 and caupolicanre and unassigned ok-coder1 Jan 4, 2026
Copy link
Collaborator

@aravindvnair99 aravindvnair99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve conflicts, rebase with master and also revert the formatting.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@caupolicanre Perhaps you had an auto format enabled which is a common setting in VS Code, linting tools, etc. I see the diff is mostly whitespace changes. You can resync this file from master and reapply the changes.

@ok-coder1
Copy link
Collaborator

I feel like ▰▱ should be added as another symbol version

@caupolicanre
Copy link
Author

caupolicanre commented Feb 6, 2026

@caupolicanre Can you please resolve conflicts?

@ok-coder1
Done.
I just pushed the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants