flymd icon indicating copy to clipboard operation
flymd copied to clipboard

Allow rendering for buffers without a name/path

Open der-daniel opened this issue 8 years ago • 3 comments

Like stated in Issue https://github.com/mola-T/flymd/issues/7, I was not able to render Markdown in a buffer without or with a strange name. I made some minor changed to write such buffer to /tmp/ or the setq'd output-dir.

I also removed the file extension check, since it does not provide any sanity. If you render a non Markdown file nothing dramatic happens. :smile:

Thanks for this nice Package. I hope the will make its way into the project.

Feel free to criticize changes I made.

For Frodo, Daniel

der-daniel avatar Aug 22 '16 14:08 der-daniel

Sorry for late reply.

I think checking for file extension is necessary. "If you render a non Markdown file nothing dramatic happens." That's not accurate because a .md file is still tried to be generated regardless the source constantly.

Generally, you can edit flymd-markdown-file-type to allow other file types. However, I think you problem is you tried to use flymd-flyit in temp buffer (ie. without a saved file). Is it the case? If yes, I could add some workaround.

Having absolute path /tmp/ is not preferred. Windows user may have unexpected error with the path. If you want to change the output path, you can customize flymd-output-directory.

Thanks

mola-T avatar Aug 28 '16 03:08 mola-T

Hi,

yes I tried it with a temp buffer. I am using it with "Edit with Emacs" Chrome Extension.

Please add a Word Around.

For Frodo

der-daniel avatar Sep 14 '16 21:09 der-daniel

Unless the act of generating markdown causes some serious side effect that like breaking emacs, I'm inclined to agree with @der-Daniel's original statement that it's unnecessary to check the file extension, and actually detrimental. A file's extension is no guarantee of its contents. It's fairly common for markdown files to not have an extension at all, for instance. If flymd tries to render a non-markdown file as markdown, what's the problem? The user has asked for something non-nonsensical, and that's what they'll get. It may look garbled, but that's their fault.

I'm in favor of taking that requirement out. More will be gained from removing this requirement than keeping it, in my opinion. I was just about to post an issue for this, but I discovered this pull request first.

P.S. @der-Daniel You should run M-x delete-trailing-whitespace on your code. :)

nixjdm avatar Aug 28 '17 21:08 nixjdm