3
2
I would like to know if there is a PHP web application, such that
- When called with something like
http://example.com/index.php?inputfile=mymarkdownfile.txt
; it will open the filemymarkdownfile.txt
at the same location asindex.php
on the webserver, and render it as Markdown (i.e., it will convert the Markdown to HTML and serve it) - There will be an "edit" button, which opens a "live preview" Markdown editor (like on StackExchange/StackOverflow sites)
- When you're done editing and click on the "save" button, previous version is archived on server (saved as text file
mymarkdownfile-
timestamp.txt
), and the changed version is saved asmymarkdownfile.txt
. - If you try to "open" a "nonexisting file" (say, via
http://example.com/index.php?inputfile=nonexistant.txt
), then the editor starts first; and the content typed there will be saved asnonexistant.txt
(andnonexistant-
timestamp.txt
)
I just need this for server based note taking, and I don't really need local linking or anything like that; nor user authentication nor protection (I'd intend to use this on local network, so I wouldn't be worried about public exposure of "edit" button and vandalism).
I imagine it could be a PHP page, which uses:
- PHP Markdown library for the initial conversion to HTML when the page request is first read
- pagedown - A JavaScript Markdown converter and editor (see also Is there any good Markdown Javascript library or control? - Stack Overflow) for when the editor is active..
Anything like that out there?
Many thanks in advance for any answers,
Cheers!
1
I was looking for exactly this a while ago. Didn't find it. Settled with markdoc.
– Der Hochstapler – 2012-05-26T17:33:08.553Cheers, @OliverSalzburg - thanks for the reference! – sdaau – 2012-05-26T17:36:25.940
1
I also looked at jekyll. And I use MarkdownPad for editing. Sadly not even close to what I (and you) originally wanted. But it works. History can be provided by VCS like git if the product doesn't have anything built in. Good luck! :)
– Der Hochstapler – 2012-05-26T17:40:11.167Thanks for those references too, @OliverSalzburg - since apparently there is nothing else, I put something together, please see answer below. Cheers!
– sdaau – 2012-05-26T23:29:19.417