Mobile app version of vmapp.org
Login or Join
Michele947

: Run external application on markdown source in ikiwiki Can I add a button to each wiki page in ikiwiki which launches an external application (on the client side) or script with the markdown

@Michele947

Posted in: #Html #Javascript #LookingForAScript #Wiki

Can I add a button to each wiki page in ikiwiki which launches an external application (on the client side) or script with the markdown code of the current page as input?

Edit: I didn't realize that it might be complicated to do it on client side as Zenklys' answer suggested. So perhaps I should describe more concretely what I have in mind:

I want to have two buttons:


"Get LaTeX" and 2. "Get pdf".


Clicking on "Get LaTeX should generate a LaTeX file and the browser should simply open or download that file. Analogously for the pdf.

It would even be ok, to have a button "Generate LaTeX" instead, which generates the LaTeX code and changes after the generation to "Get LaTeX" which simply points to the LaTeX file.

So it is not really necessary to do the generation of the files on client side. Would be ok, if this is done (on a temporary folder) on server side.

For the LaTeX resp. pdf generation I want to use a custom wrapper script for pandoc, let's call it mymarkdown2latex resp. mymarkdown2pdf.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Michele947

2 Comments

Sorted by latest first Latest Oldest Best

 

@Candy875

How difficult this is would depend on what technologies you are using server-side and how readily available you can find existing code to convert HTML to LaTeX and PDF. However this should be a server-side thing, and shouldn't even be necessary to write to disk (temporary file like you say) unless you cared about caching. The links should point to server-side scripts that will convert the Markdown to HTML (assuming it's easier to convert to/from HTML than to/from Markdown directly) and then to either LaTeX or PDF and return the response using a header that will trigger download in the browser, such as:

Content-disposition: attachment; filename=your_page.tex


Edit: Looks like ikiwiki uses PERL. Here are some resources using that language:


PDF-FromHTML
html2tex

10% popularity Vote Up Vote Down


 

@Nimeshi995

That is actually pretty difficult. All you can do is include links. Links can have certain protocols. For example when printing a www.whateverlink.com, your operating system is configured to open those with a web browser.

When using ftp:// for example, it will try to open the link with a ftp client. You can try to use a protocol used for markdown edition, but I doubt you'll find any standard for that.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme