charmbracelet / glamour

Stylesheet-based markdown rendering for your CLI apps 💇🏻‍♀️

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to ignore reference-style links

rdnlsmith opened this issue · comments

I use Markdown syntax when writing git commit messages, and I would love to use glow as a pager for git log. This works pretty well:

git log --pretty="format:'## %s (%h)%n%n_%aN | %ah_%n%n%b'" | glow -p -w 80 -

Except that I use reference-style links, to avoid breaking the flow of text when I need to read the log without the benefit of Markdown rendering:

For example, this is a body paragraph with a [link to some docs][1]
related to the changes in some commit.

[1]: https://example.com

This is fine for viewing a single commit, but if I pipe git log through glow as above, the URLs from the topmost commits get inserted into every commit message that includes a link with the same number. It would be really great if there were a flag I could use to leave these links as they are in the raw text!

Huge links in the middle of a paragraph really do break the flow of text.
An option to preserve reference links would improve the readability.
Maybe even converting all links into reference links can look great.

| Maybe even converting all links into reference links can look great.

Found a tool for that, doesn't seem to be maintained or complete, though.
https://github.com/sayanarijit/md-footer

I will try to implemet this 😁

Looking deeper at the code, it feels like it must be done at the parser level, not renderer level, @muesli what do you think?

Looking deeper at the code, it feels like it must be done at the parser level, not renderer level, @muesli what do you think?

Yeah, I don't think we can even detect these situations in glamour itself.