|
1 |
| -Single-page Markdown Web Editor (`spmdwe`) |
2 |
| -=== |
3 |
| -Copyleft [rigon](http://www.rigon.tk), February 2016 |
4 |
| - |
5 |
| -Homepage and demo: |
6 |
| - |
7 |
| -* [http://www.spmdwe.tk](http://www.spmdwe.tk) |
8 |
| - |
9 |
| - |
10 |
| -Intro |
11 |
| ---- |
12 |
| - |
13 |
| -This is a small "web application". It's based on a application called **spmdwe**, created by sdaau in 2012: |
14 |
| - |
15 |
| -* [http://sdaaubckp.sourceforge.net/spmdwe/spmdwe.php](http://sdaaubckp.sourceforge.net/spmdwe/spmdwe.php) |
16 |
| - |
17 |
| -The application consists on one file. It can be installed on a PHP Web Server and can used to edit text files with live preview for Markdown syntax. With proper permissions on the server's directory, files can also be saved on the host (a backup of the previous version is also saved). There are two switches, one that disables saving and other that disables authentication. |
18 |
| - |
19 |
| -It is based on four other open-source packages, which can be downloaded separately (see Installation below): |
20 |
| - |
21 |
| -* [pagedown - A JavaScript Markdown converter and editor](http://code.google.com/p/pagedown/) (_see also [this post](http://stackoverflow.com/a/135155/277826)_) |
22 |
| -* [JQuery](http://jquery.com/) |
23 |
| -* [Bootstrap](http://getbootstrap.com/) |
24 |
| -* [Dropzone.js](http://www.dropzonejs.com/) |
25 |
| - |
26 |
| -While the default .css style shown here is hardly impressive, do check out the list of some [free markdown css styles](markdown_styles), which can be used instead. |
27 |
| - |
28 |
| - |
29 |
| -Features |
30 |
| ---- |
31 |
| -Since this project is a fork from the original project **spmdwe**, it inherits the main features: |
32 |
| - |
33 |
| -* Editing Markdown files |
34 |
| -* Live editing, writing automatically updates the output |
35 |
| -* View and edit modes |
36 |
| -* Backup old versions of the file |
37 |
| - |
38 |
| -In this version, these new features have been added: |
39 |
| - |
40 |
| -* Fresh and modern design and layout reorganization |
41 |
| -* Clear URLs, without the hassle of URL parameters |
42 |
| -* Edition side by side with the view |
43 |
| -* Ability to navigate through history |
44 |
| -* Ready for Mobile, with responsive layout that adapts automatically |
45 |
| -* File upload management, attached to each page |
46 |
| -* Publish mode for guest users |
47 |
| -* Website template editor and previewer |
48 |
| -* Page download in HTML, Markdown and ZIP |
49 |
| -* Option to make files read only |
50 |
| -* Application improvements |
51 |
| - |
52 |
| - |
53 |
| -Docker |
54 |
| ------- |
55 |
| - |
56 |
| -You can the project inside docker with: |
57 |
| - |
58 |
| - docker run -p 80:80 -d rigon/spmdwe |
59 |
| - |
60 |
| -To save the data, you can run with a volume: |
61 |
| - |
62 |
| - docker run -p 80:80 -v spmdwe_data:/var/www/html/files -d rigon/spmdwe |
63 |
| - |
64 |
| -You can set environment variables to customize your installation: |
65 |
| - |
66 |
| - - `SITE_NAME`: Name of the Website |
67 |
| - - `HOMEPAGE`: Default page loaded for homepage |
68 |
| - - `SAVE_ENABLED`: Allow modifications |
69 |
| - - `REQUIRE_AUTH`: Require authentication to make modifications |
70 |
| - - `USER`: Username used for authentication |
71 |
| - - `PASS`: Password for the user |
72 |
| - |
73 |
| -For a multi-arch build, it can be done with: |
74 |
| - |
75 |
| - docker buildx build --push -t rigon/spmdwe --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le . |
76 |
| - |
77 |
| -Download |
78 |
| ---- |
79 |
| -There is the link to download: |
80 |
| - |
81 |
| -* [https://github.com/rigon/notes/archive/master.zip](https://github.com/rigon/notes/archive/master.zip) |
82 |
| - |
83 |
| - |
84 |
| -Installation |
85 |
| ---- |
86 |
| - |
87 |
| -Here are the steps needed to install this application, in the form of `bash` commands: |
88 |
| - |
89 |
| - # mkdir spmdwe # if downloading manually, else: |
90 |
| - # checkout from svn - creates `spmdwe` directory and files in it |
91 |
| - wget https://github.com/rigon/notes/archive/master.zip |
92 |
| - unzip master.zip |
93 |
| - mv notes-master/ notes |
94 |
| - |
95 |
| - sudo chown www-data:www-data notes/files # on server, else cannot save files! |
96 |
| - |
97 |
| - |
98 |
| -Configuration |
99 |
| ---- |
100 |
| -To work properly it is required the ```ReWrite``` Module to be active in apache. |
101 |
| - |
102 |
| -Then the next configuration should be used. This can be done via `.htaccess` file or on apache configuration: |
103 |
| - |
104 |
| - RewriteEngine on |
105 |
| - |
106 |
| - RewriteCond %{REQUEST_URI} !^/notes/static |
107 |
| - RewriteCond %{REQUEST_URI} !^/notes/files/[^/]+/[^/]+\.[^/]+ |
108 |
| - |
109 |
| - RewriteRule ^([^/]*)$ index.php?file=$1 [L,QSA] |
110 |
| - |
111 |
| - |
112 |
| - RewriteCond %{REQUEST_URI} !^/notes/static |
113 |
| - RewriteCond %{REQUEST_URI} !^/notes/files/[^/]+/[^/]+\.[^/]+ |
114 |
| - |
115 |
| - RewriteRule .* "-" [F] |
116 |
| - |
117 |
| -You have to change the directory `/notes` to the directory you've installed. |
118 |
| - |
119 |
| - |
120 |
| -Usage |
121 |
| ----- |
122 |
| - |
123 |
| -The application is pretty simple: |
124 |
| - |
125 |
| -* there is a view mode, which doesn't show an edit box, shows the html view |
126 |
| -* there is edit mode, which shows a live html preview, edit box right next to it, and shows **Save** and **Save and View** at the end |
127 |
| -* Both `view` and `edit` can be used as values for the `mode` query string argument (see source code for details) |
128 |
| -* Upon save, the old version is backed up, with a filename with appended unix timestamp; the new version is saved under the original filename - and the new version is displayed in view mode |
129 |
| -* **Save** will save the file and continue in editing mode and **Save and View** will save and change to view mode |
130 |
| -* A file is chosen by adding manually the filename in the URL, say `http://example.com/notes/somefile.` |
131 |
| -* If a requested file (`somefile`) doesn't exist, it should be created automatically, and edit mode displayed |
132 |
| -* Otherwise, without any other arguments, a file is loaded in view mode |
133 |
| -* If the application is called without any arguments whatsoever (say, `http://example.com/notes/`), then it loads `home` and goes into view mode. |
134 |
| -* If you are a guest user, you will see the published version and you cannot edit files. |
135 |
| - |
| 1 | +Single-page Markdown Web Editor (`spmdwe`) |
| 2 | +=== |
| 3 | +Copyleft [rigon](http://www.rigon.tk), February 2016 |
| 4 | + |
| 5 | +Homepage and demo: |
| 6 | + |
| 7 | +* [http://www.spmdwe.tk](http://www.spmdwe.tk) |
| 8 | + |
| 9 | + |
| 10 | +Intro |
| 11 | +--- |
| 12 | + |
| 13 | +This is a small "web application". It's based on a application called **spmdwe**, created by sdaau in 2012: |
| 14 | + |
| 15 | +* [http://sdaaubckp.sourceforge.net/spmdwe/spmdwe.php](http://sdaaubckp.sourceforge.net/spmdwe/spmdwe.php) |
| 16 | + |
| 17 | +The application consists on one file. It can be installed on a PHP Web Server and can used to edit text files with live preview for Markdown syntax. With proper permissions on the server's directory, files can also be saved on the host (a backup of the previous version is also saved). There are two switches, one that disables saving and other that disables authentication. |
| 18 | + |
| 19 | +It is based on four other open-source packages, which can be downloaded separately (see Installation below): |
| 20 | + |
| 21 | +* [pagedown - A JavaScript Markdown converter and editor](http://code.google.com/p/pagedown/) (_see also [this post](http://stackoverflow.com/a/135155/277826)_) |
| 22 | +* [JQuery](http://jquery.com/) |
| 23 | +* [Bootstrap](http://getbootstrap.com/) |
| 24 | +* [Dropzone.js](http://www.dropzonejs.com/) |
| 25 | + |
| 26 | +While the default .css style shown here is hardly impressive, do check out the list of some [free markdown css styles](markdown_styles), which can be used instead. |
| 27 | + |
| 28 | + |
| 29 | +Features |
| 30 | +--- |
| 31 | +Since this project is a fork from the original project **spmdwe**, it inherits the main features: |
| 32 | + |
| 33 | +* Editing Markdown files |
| 34 | +* Live editing, writing automatically updates the output |
| 35 | +* View and edit modes |
| 36 | +* Backup old versions of the file |
| 37 | + |
| 38 | +In this version, these new features have been added: |
| 39 | + |
| 40 | +* Fresh and modern design and layout reorganization |
| 41 | +* Clear URLs, without the hassle of URL parameters |
| 42 | +* Edition side by side with the view |
| 43 | +* Ability to navigate through history |
| 44 | +* Ready for Mobile, with responsive layout that adapts automatically |
| 45 | +* File upload management, attached to each page |
| 46 | +* Publish mode for guest users |
| 47 | +* Website template editor and previewer |
| 48 | +* Page download in HTML, Markdown and ZIP |
| 49 | +* Option to make files read only |
| 50 | +* Application improvements |
| 51 | + |
| 52 | + |
| 53 | +Docker |
| 54 | +------ |
| 55 | + |
| 56 | +You can the project inside docker with: |
| 57 | + |
| 58 | + docker run -p 80:80 -d rigon/spmdwe |
| 59 | + |
| 60 | +To save the data, you can run with a volume: |
| 61 | + |
| 62 | + docker run -p 80:80 -v spmdwe_data:/var/www/html/files -d rigon/spmdwe |
| 63 | + |
| 64 | +You can set environment variables to customize your installation: |
| 65 | + |
| 66 | + - `SITE_NAME`: Name of the Website |
| 67 | + - `HOMEPAGE`: Default page loaded for homepage |
| 68 | + - `SAVE_ENABLED`: Allow modifications |
| 69 | + - `REQUIRE_AUTH`: Require authentication to make modifications |
| 70 | + - `USER`: Username used for authentication |
| 71 | + - `PASS`: Password for the user |
| 72 | + |
| 73 | +For a multi-arch build, it can be done with: |
| 74 | + |
| 75 | + docker buildx build --push -t rigon/spmdwe --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le . |
| 76 | + |
| 77 | +Download |
| 78 | +--- |
| 79 | +There is the link to download: |
| 80 | + |
| 81 | +* [https://github.com/rigon/notes/archive/master.zip](https://github.com/rigon/notes/archive/master.zip) |
| 82 | + |
| 83 | + |
| 84 | +Installation |
| 85 | +--- |
| 86 | + |
| 87 | +Here are the steps needed to install this application, in the form of `bash` commands: |
| 88 | + |
| 89 | + # mkdir spmdwe # if downloading manually, else: |
| 90 | + # checkout from svn - creates `spmdwe` directory and files in it |
| 91 | + wget https://github.com/rigon/notes/archive/master.zip |
| 92 | + unzip master.zip |
| 93 | + mv notes-master/ notes |
| 94 | + |
| 95 | + sudo chown www-data:www-data notes/files # on server, else cannot save files! |
| 96 | + |
| 97 | + |
| 98 | +Configuration |
| 99 | +--- |
| 100 | +To work properly it is required the ```ReWrite``` Module to be active in apache. |
| 101 | + |
| 102 | +Then the next configuration should be used. This can be done via `.htaccess` file or on apache configuration: |
| 103 | + |
| 104 | + RewriteEngine on |
| 105 | + |
| 106 | + # Rewrite URL as a query parameter for index.php |
| 107 | + RewriteCond %{REQUEST_URI} !^/static |
| 108 | + RewriteCond %{REQUEST_URI} !^/files/(([\w-_,\ ]+\.)*[\w-_,\ ]+\/)+([\w-_,\ ]+\.)*[\w-_,\ ]+$ |
| 109 | + RewriteRule ^([^/]*)$ index.php?file=$1 [L,QSA] |
| 110 | + |
| 111 | + # Forbid non-existing URLs |
| 112 | + RewriteCond %{REQUEST_URI} !^/static |
| 113 | + RewriteCond %{REQUEST_URI} !^/files/(([\w-_,\ ]+\.)*[\w-_,\ ]+\/)+([\w-_,\ ]+\.)*[\w-_,\ ]+$ |
| 114 | + RewriteRule .* "-" [F] |
| 115 | + |
| 116 | +You have to change the directory `/notes` to the directory you've installed. |
| 117 | + |
| 118 | + |
| 119 | +Usage |
| 120 | +---- |
| 121 | + |
| 122 | +The application is pretty simple: |
| 123 | + |
| 124 | +* there is a view mode, which doesn't show an edit box, shows the html view |
| 125 | +* there is edit mode, which shows a live html preview, edit box right next to it, and shows **Save** and **Save and View** at the end |
| 126 | +* Both `view` and `edit` can be used as values for the `mode` query string argument (see source code for details) |
| 127 | +* Upon save, the old version is backed up, with a filename with appended unix timestamp; the new version is saved under the original filename - and the new version is displayed in view mode |
| 128 | +* **Save** will save the file and continue in editing mode and **Save and View** will save and change to view mode |
| 129 | +* A file is chosen by adding manually the filename in the URL, say `http://example.com/notes/somefile.` |
| 130 | +* If a requested file (`somefile`) doesn't exist, it should be created automatically, and edit mode displayed |
| 131 | +* Otherwise, without any other arguments, a file is loaded in view mode |
| 132 | +* If the application is called without any arguments whatsoever (say, `http://example.com/notes/`), then it loads `home` and goes into view mode. |
| 133 | +* If you are a guest user, you will see the published version and you cannot edit files. |
| 134 | + |
0 commit comments