charmbracelet / glow

Render markdown on the CLI, with pizzazz! 💅🏻
MIT License
16.27k stars 356 forks source link

glow not rendering heading levels other than top-level #646

Open Halfwalker opened 2 months ago

Halfwalker commented 2 months ago

Describe the bug glow does not seem to render headings other than top-level # Heading 1. Other levels like ## Heading 2 render in a color, but also show the ##

Setup

Source Code Simple test.md

# Heading 1

## Heading 2

### Heading 3

#### Heading 4

* list item
* another list item
    * sub-list item
    * and another

Normal text
*single asterisk*
**double asterisk**
_underscore_
__double underscore__

Expected behavior The sample test.md should render appropriately. # Heading 1 renders as expected, with coloring/bold/etc. ## Heading 2 and the others only render in blue and show the heading level hashes

This may well be an unintended and unexpected confluence of factors like font, terminal etc.

Screenshots Screenshot from 2024-09-06 10-17-21

Additional context Using the "Hack Nerd Font" for alacritty and gnome-terminal

DanielKaleby commented 1 month ago

They are being recognized and rendered. specifically, what is the expected formatting?

Halfwalker commented 1 month ago

I suppose I was expecting no ## in front, and some sort of color/bold formatting to discern the heading levels.

Heading 1 is highlighted as I would expect, but the rest are all the same color and show the hashes (I guess to indicate the level ?)

I understand that just color/bold would be nice but wouldn't actually indicate the Heading level. Maybe include the ## in front but also use color/bold ?

DanielKaleby commented 1 month ago

This is correct, h1 is the only different one because it should be the most eye-catching, the hash symbol is still present at the other levels to indicate which level that header is, given that they have the same color. However, since h1 is the only one that is different, it does not need a hash sign to indicate its level, since it only has one level of level 1. There is no need for a unique color for each header, as this would not eliminate the need for characters indicating the level (a user could memorize the color associated with each level, but the color itself is not able to indicate which header is superior to another), the current design seems to be appropriate, but since everything in Glow is colorful, this might make sense..

Halfwalker commented 1 month ago

Personally I would like colors/bolding, but keep the ## leaders. While the colors make it fast to discern like headings, the ## are a definitive indicator to the level.

Heh, if you do decide to add this, perhaps make it configurable. What looks nice in one terminal color scheme (solarized_dark) might be eye-stabbing in another :P

dudicoco commented 1 month ago

FYI it is configurable: https://github.com/charmbracelet/glamour/tree/master/styles

The Catppuccin theme supports different colors per header.

Halfwalker commented 1 month ago

Yeah, hence keeping the ## for the headers would be a good thing. But I do like the idea of different colors for each header level (hint hint) :)