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 file mymarkdownfile.txt at the same location as index.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 as mymarkdownfile.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 as nonexistant.txt (and nonexistant-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:

Anything like that out there?

Many thanks in advance for any answers,

closed as off topic by random May 27 '12 at 13:34

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I was looking for exactly this a while ago. Didn't find it. Settled with markdoc. – Der Hochstapler May 26 '12 at 17:33
  • Cheers, @OliverSalzburg - thanks for the reference! – sdaau May 26 '12 at 17:36
  • 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 May 26 '12 at 17:40
  • Thanks for those references too, @OliverSalzburg - since apparently there is nothing else, I put something together, please see answer below. Cheers! – sdaau May 26 '12 at 23:29

Well, given that I really needed something like this, I put together a small PHP script/application that does the above; called it the Single-page Markdown Web Editor (spmdwe); please see:

enter image description here

Hope this helps someone,

  • Thanks for building this. It's just what I was looking for (mainly for checking the rendering of markdown as I enter it). I presume it wouldn't be too much of a mission to adapt to load/save data to/from a tuple in a database instead of a file. – Agi Hammerthief Nov 11 '14 at 19:00
  • Also, your code doesn't sanitize input retrieved from $_REQUEST[] before outputting it directly. You should do something about that. – Agi Hammerthief Nov 11 '14 at 19:10
  • Based on this useful application, I developed a new one. It has a nicer interface and more functions like history, download file, mark a file as read-only and view and editing modes. It is available here: spmdwe.tk The repository is available here: github.com/rigon/notes – rigon Apr 3 '15 at 14:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.