Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

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.

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.

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 🌚)...

action.yml Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants