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

✨ Making CodeSnips Pretty #294

Closed

Conversation

AdiAkhileshSingh15
Copy link
Contributor

@AdiAkhileshSingh15 AdiAkhileshSingh15 commented Aug 16, 2023

This pull request addresses issue #241 . It aims to improve the readability of the codeSnip script in the output YAML. I had previously submitted a pull request (#293 ) for the same issue, but that approach was quite lengthy and unconventional. Upon further investigation into why the codesnip wasn't being marshaled into the desired '|' block scalar style literal, I discovered that any \s (whitespace) character following a \n (newline) caused the string to be treated as a regular string. To resolve this, I removed any spaces that appeared after the \n in the incident.CodeSnip.
@pranavgaikwad Sir, can you please check this.

Signed-off-by: AdiAkhileshSingh15 <[email protected]>
@pranavgaikwad
Copy link
Contributor

@AdiAkhileshSingh15 Thank you for your PR! While this solves the issue, it appears that this is manipulating the original snip which we don't want because code snips are also displayed in the UI. I feel that there may not be a sane solution to this issue.

@AdiAkhileshSingh15
Copy link
Contributor Author

AdiAkhileshSingh15 commented Aug 22, 2023

@pranavgaikwad While this approach does indeed manipulate the original codesnip, it's important to note that it could result in an ugly UI only if maintaining the tab alignment at the start of each line is important, and is not maintained otherwise in the UI.

@pranavgaikwad
Copy link
Contributor

@AdiAkhileshSingh15 UI displays code snippets in a code editor, if we take out spaces / tabs from original snip, that will mess up the alignment of lines

@AdiAkhileshSingh15
Copy link
Contributor Author

@pranavgaikwad Okay! Then i guess we don't have a proper solution to this issue, if we can't manipulate the codesnip in violations.

@pranavgaikwad
Copy link
Contributor

@AdiAkhileshSingh15 apologies, I should have researched this a little more before commenting on the issue. I think my comment is leading folks to believe default yaml marshaling is just going to work. Looks like it won't. Closing this PR...and updating issue. Please feel free to re-open or create new PR if you do solve this correctly.

@AdiAkhileshSingh15
Copy link
Contributor Author

@AdiAkhileshSingh15 apologies, I should have researched this a little more before commenting on the issue. I think my comment is leading folks to believe default yaml marshaling is just going to work. Looks like it won't. Closing this PR...and updating issue. Please feel free to re-open or create new PR if you do solve this correctly.

Ohkay! No problem.
And, yeah sure, will update you if i find a correct solution for this issue.

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.

2 participants