charmbracelet / glow

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

Print specific part of the Markdown by syntax #605

Closed marcelarie closed 4 months ago

marcelarie commented 7 months ago

I've been using glow for a while now, and thought of a few cool features that could make it even better. Not sure if these fit the project's direction, but here they are:

  1. Selective Header Printing: It'd be awesome to print specific headers directly. Something like:
glow --elements=header --patter-=User*

to get all element headers starting with "User".

The elements could be:

Another useful example would be to print only code blocks:

glow --elements=code_block

These ideas might be a bit scattered, but in a way I think are related.

  1. Viewing Specific Document Sections: Like tail or head. Quick examples:
    • For the first 10 lines:
glow --head
glow --tail=10
glow --head=5

If it's tricky to implement, maybe a --color-always option could help keep syntax color when piping to head or tail.

caarlos0 commented 4 months ago

hey, I don't think this is within the scope of glow, at least not now.

thanks for the issue though, and sorry for the delay!