notes

Single-page Markdown Web Editor (spmdwe)

Copyleft rigon, February 2016

Homepage and demo:

Intro

This is a small “web application”. It’s based on a application called spmdwe, created by sdaau in 2012:

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.

It is based on four other open-source packages, which can be downloaded separately (see Installation below):

While the default .css style shown here is hardly impressive, do check out the list of some free markdown css styles, which can be used instead.

Features

Since this project is a fork from the original project spmdwe, it inherits the main features:

In this version, these new features have been added:

Docker

You can the project inside docker with:

docker run -p 80:80 -d rigon/spmdwe

To save the data, you can run with a volume:

docker run -p 80:80 -v spmdwe_data:/var/www/html/files -d rigon/spmdwe

You can set environment variables to customize your installation:

For a multi-arch build, it can be done with:

docker buildx build --push -t rigon/spmdwe --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le .

Download

There is the link to download:

Installation

Here are the steps needed to install this application, in the form of bash commands:

# mkdir spmdwe # if downloading manually, else:
# checkout from svn - creates `spmdwe` directory and files in it
wget https://github.com/rigon/notes/archive/master.zip
unzip master.zip
mv notes-master/ notes

sudo chown www-data:www-data notes/files  # on server, else cannot save files!

Configuration

To work properly it is required the ReWrite Module to be active in apache.

Then the next configuration should be used. This can be done via .htaccess file or on apache configuration:

RewriteEngine on

# Rewrite URL as a query parameter for index.php
RewriteCond %{REQUEST_URI} !^/static
RewriteCond %{REQUEST_URI} !^/files/(([\w-_,\ ]+\.)*[\w-_,\ ]+\/)+([\w-_,\ ]+\.)*[\w-_,\ ]+$
RewriteRule ^([^/]*)$ index.php?file=$1 [L,QSA]

# Forbid non-existing URLs
RewriteCond %{REQUEST_URI} !^/static
RewriteCond %{REQUEST_URI} !^/files/(([\w-_,\ ]+\.)*[\w-_,\ ]+\/)+([\w-_,\ ]+\.)*[\w-_,\ ]+$
RewriteRule .* "-" [F]

You have to change the directory /notes to the directory you’ve installed.

Usage

The application is pretty simple: