X Tutup
Skip to content

Refactor use of glamour to allow style overrides#3243

Merged
vilmibm merged 2 commits intotrunkfrom
markdown-indent-override
Mar 19, 2021
Merged

Refactor use of glamour to allow style overrides#3243
vilmibm merged 2 commits intotrunkfrom
markdown-indent-override

Conversation

@vilmibm
Copy link
Copy Markdown
Contributor

@vilmibm vilmibm commented Mar 16, 2021

This PR gently augments markdown.Render, overriding the margin settings that come default in the glamour styles to remove all margins.

This came about because I wanted workflow view to list yaml without 4 spaces of unneeded indentation and, after discovering that glamour indeed supported cascading styles, decided I wanted to remove the excessive indentation from all of our markdown output.

To see this in action, view any issue, PR, or gist. The leading 2-4 spaces will be gone from the markdown output.

Note that codeblocks in an issue body are now at the same indentation level as the surrounding text. I like this change, but if others don't I can re-add the margin for code blocks and then change my workflow view PR to one-off remove it again.

Sample screenshot (first invocation is before, second is after):

image

@vilmibm vilmibm requested review from mislav and samcoe March 16, 2021 20:44
Copy link
Copy Markdown
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

This looks great from the code perspective, but something that I'm wondering about is whether this will degrade the experience in some existing view commands. In most of them, I don't think the margin mattered much, but I think that in issue view --comments the left margin that was the previous default might have actually improved readability.

Copy link
Copy Markdown
Contributor

@samcoe samcoe left a comment

Choose a reason for hiding this comment

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

I agree with @mislav. Code here looks great. I personally think the indented view looks better and is easier to parse though. @ampinsk do you have thoughts?

@mislav
Copy link
Copy Markdown
Contributor

mislav commented Mar 17, 2021

Also, now that I think about it, I would prefer that code blocks are indented by default in markdown rendering. It resembles how they would usually be formatted in plain text documents such as man pages.

Is there a way that removing indentation could be opt-in?

@ampinsk
Copy link
Copy Markdown

ampinsk commented Mar 17, 2021

@vilmibm ran this by me, and I thought removing indentation overall helped, but agree that codeblocks could be indented. On comments, I think removing indentation could help but I also think it could use some spacing cleanup between blocks of information if we do.

@vilmibm
Copy link
Copy Markdown
Contributor Author

vilmibm commented Mar 17, 2021

thanks yall! I'll tweak this accordingly.

@vilmibm
Copy link
Copy Markdown
Contributor Author

vilmibm commented Mar 19, 2021

I've rolled back the default indentation changes for now until we can be more thorough with them across the board; for now I've just made it possible to do what I want to do in workflow view.

@vilmibm vilmibm enabled auto-merge (squash) March 19, 2021 16:25
@vilmibm vilmibm merged commit 2ab073d into trunk Mar 19, 2021
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.

4 participants

X Tutup