Markdown "single page" PHP web application with live preview?
2013-10
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!
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:
Hope this helps someone,
Cheers!
I'm trying to login into sitejot and I get the error
Fatal error: Maximum execution time of 50 seconds exceeded
in /home/sitejot/public_html/login.php on line 23
- It only happens on one pc, all other pc's at my house do not encounter this error
- It happens consistently every time regardless of browser - IE, Firefox, Chrome
- I can move the pc to be behind another router and the error remains
- It is particular to this web page, other pages in the same web site are ok, and I don't have any problems with any other web pages
- Googling "Fatal error: Maximum execution time of 50 seconds exceeded" returns a huge number of hits, so this seems to be a common problem
- I've upgraded my pc to Windows 7 with no improvement
Here is the POST request:
POST /login.php HTTP/1.1
Accept: application/x-ms-application, image/gif, application/xaml+xml,
application/x-ms-xbap, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-xpsdocument, */*
Referer: http://www.sitejot.com/
Accept-Language: en-CA User-Agent:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2;
.NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;
Media Center PC 6.0; Media Center PC 5.0; SLCC1)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: www.sitejot.com
Content-Length: 55
Connection: Keep-Alive
Pragma: no-cache
There's is no response and eventually it times out. Here is the response header:
HTTP/1.1 200 OK
Date: Thu, 10 Dec 2009 05:15:51 GMT
Server: Apache/2.0.61 (Unix) mod_ssl/2.0.61
OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 PHP/5.2.5
X-Powered-By: PHP/5.2.5
Set-Cookie: sj_user=
Set-Cookie: sj_pw=
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 144
Keep-Alive: timeout=15, max=97
Connection: Keep-Alive
Content-Type: text/html
What can I try to fix this issue?
This is a problem with the website itself. It appears that they have poorly written code on their end. Particularly with the login script.
It could be a loop that never ends, a resource they aren't able to access or any other thing.
It is no fault of yours, unless you count wanting to log into their site as a user error.
Either way, it's localised to their site and to this page.
Eight Days is spot on; this is a problem with the website itself.
You should contact the site's owner/support staff and let them know about the problem. File a bug report with them. They may need information from you regarding the configuration of the machine that fails vs the machines that work.