markdown-preview.nvim icon indicating copy to clipboard operation
markdown-preview.nvim copied to clipboard

Implement a :MarkdownExport option

Open ghost opened this issue 5 years ago • 13 comments

It would be really nice if there was a :MarkdownSave command that would save the HTML file, css/js in the current directory. Ie File > Save Page As... from the web browser.

It would be good if such a command made sure the paths were relative so that the HTML page could be opened and they would be sourced correctly.

It would be good to be able to read the files from a file:/// location.

Might also be worth having an option there to not optimize output (ie remove line feeds from source).

ghost avatar Feb 28 '19 11:02 ghost

It is not much easy to implement this feature. Maybe will implement it in the future but not sure. Also PR always welcome.

iamcco avatar Feb 28 '19 14:02 iamcco

not much easy to implement this feature

Ah. I wasn't sure about that.

ghost avatar Feb 28 '19 14:02 ghost

There are not just static document, as katex, mermaid and chart.js are dynamically add by script.

iamcco avatar Mar 01 '19 02:03 iamcco

Is there a way to do a PDF rendering? I'm currently looking for a nice workflow to write up notes and then disseminate them to others that are less enlightened in the way of vim.

jarredbarber avatar Jul 22 '19 18:07 jarredbarber

Just a suggestion, but I feel it might be useful to allow the rendered HTML to be piped/passed to a separate script or application. I think if we could pass the HTML to, say, wkhtmltopdf (or a bash script wrapping it), then it might work... Would give some flexibility at least.

ghost avatar Jan 29 '20 20:01 ghost

I have tried to use it with wkhtmltopdf directly with the local url, because of the scripts that are being served, and I always get a pdf with the legend "An unexpected error has ocurred" and nothing else

mxdevmanuel avatar Mar 09 '20 20:03 mxdevmanuel

What are you guys currently doing to export as pdf ?

motorto avatar Jul 03 '21 15:07 motorto

I currently use firefox ctrl+p to print it as a pdf file

Utkarsh-khambra avatar Jul 16 '21 08:07 Utkarsh-khambra

What theme it is using while rendering preview ??

ukantjadia avatar Jul 31 '22 00:07 ukantjadia

@Utkarsh-khambra there anything to save it in html ??

ukantjadia avatar Aug 11 '22 22:08 ukantjadia

@ukantjadia you can use firefox save page as option to save it as html files.

Utkarsh-khambra avatar Aug 12 '22 05:08 Utkarsh-khambra

For doing that, what would be need? In a :MarkdownExport command, we would like need to create a pipeline of functions that would split the markdown... As an example: I got some text, then some math, then some dot so I would need find math, dots sections, render it separately with some script, then crop it as images or something like in the text? Can we maybe transform that enhancement into a list of needed operations, scripts that we could develop separately?

dostoievsky avatar Jan 10 '23 16:01 dostoievsky

You could pipe plain markdown files through pandoc, but it will look different than what you see in the browser and will not work with mermaid and all the other features.

Seems like a low value workaround

djheidihoe avatar Sep 09 '23 12:09 djheidihoe