silverbulletmd / silverbullet

The hackable notebook
https://silverbullet.md
MIT License
2.06k stars 146 forks source link

Pre-fill new page name with heading #744

Closed PatrikStenmark closed 4 months ago

PatrikStenmark commented 4 months ago

Hi!

Just started using silverbullet and find it to be fantastic.

One small thing I've noticed: I often start with one page where I write stuff, using headings. When this page gets too long, I extract part of it, usually starting with a heading. And in most cases I want to name the page the exact same thing as the heading. So with this change, when extracting a page, it will check if the first line is a markdown heading. If it is, it will be used as a default name in the prompt asking for a page name.

This uses a regular expression to check for a heading. It seemed a bit overkill to do a full markdown parsing for this specific check.

JavaScript is far from my primary programming language, so please let me know if I'm doing something bad and I'll be happy to fix it!

zefhemel commented 4 months ago

Looks good and useful. Thanks!