jannis-baum / Vivify

Bring your Markdown to life
GNU General Public License v3.0
34 stars 4 forks source link

Parse empty files #150

Closed jannis-baum closed 3 months ago

jannis-baum commented 3 months ago

Close #149

jannis-baum commented 3 months ago

One caveat here is of course that you have to save the file before you can open Vivify, on a new Vim buffer that is not saved yet this won't work because Vivify is organized in parallel to the file system

tuurep commented 3 months ago

Yes, exactly what I was after! Thanks!

Also tested with an extensionless file, and opens this:

image

Whereas before it would have asked me if I want to save file, because of this firefox setting I think:

image

And showing the empty text file is much better in my opinion

jannis-baum commented 3 months ago

Nice! Happy this was so easy for once hahahaha

Whereas before it would have asked me if I want to save file, because of this firefox setting I think:

Yeah files with shouldRender(...) == false will be sent as data which is necessary e.g. to render local images in Markdown files. And browsers will do the download when they get data.

Tweekism commented 3 months ago

On Windows, this will be application/x-empty

Mental note for me for later...

tuurep commented 3 months ago

Btw this doesn't behave so well when you delete all contents in a file while previewing,

But I'm not sure how much is related to:

Vivify is organized in parallel to the file system

Is it changing the file -type on the fly, if you know what I mean?

jannis-baum commented 3 months ago

@tuurep Ah okay, this is probably because the empty string resolves to "false" so it doesn't update it and then it still has the live content saved when you reopen it. I'll fix that later :)

tuurep commented 3 months ago

Nice, sounds like an easy problem :smile: