The code behind http://markdownshare.com/
This is a simple pastebin-like service which allows a user to submit text which is formatted in Markdown, and share the resulting HTML.
A user uploads Markdown and both the rendered HTML and the original markdown are available.
The user will be able to delete the content post-upload, if they so wish.
In addition to having
We've now switched to using UUIDs, which means that the URLs are longer but that it isn't possible for a remote attacker to spider the complete list of uploaded documents.
It would have been possible to mix both schemes indefinitely, and allow the user to choose between "Normal" and "Secure", but I'd rather remove a checkbox/combobox and keep the interface simple.
There is a sample Apache2 virtual-host file provided, which documents the rewrites which are required to make the application run with clean URLs.
Additionally there is a provided Dockerfile, which allows you to easily build a container with a copy of the project code within it. This container may then be launched to give yourself a local instance of the application in an isolated environment.
There is a pre-built container available from the docker index:
https://markdownshare.com/faq/
This is a simple pastebin-like service which allows a user to submit text which is formatted in Markdown, and share the resulting HTML.
A user uploads Markdown and both the rendered HTML and the original markdown are available.
The user will be able to delete the content post-upload, if they so wish.
Requirements
The service uses Redis for persistence, but I'm open to the idea of using the filesystem instead if there is a preference.In addition to having
redis
listening upon localhost you will
need the following Perl modules:- CGI::Application
- CGI::Session
- Data::UUID
- Digest::MD5
- HTML::Parser
- This is optional and used to provide
:emojis:
support
- This is optional and used to provide
- HTML::Template
- JSON
- Math::Base36
- Redis
- Text::MultiMarkdown
$ apt-get install libossp-uuid-perl libjson-perl libhtml-template-perl \
libmath-base36-perl libredis-perl libtext-multimarkdown-perl \
perl perl-modules libcgi-application-perl libcgi-session-perl \
libhtml-parser-perl
Notes
In the past we used a single incrementing integer for storing all submissions, which was base36-encoded for brevity.We've now switched to using UUIDs, which means that the URLs are longer but that it isn't possible for a remote attacker to spider the complete list of uploaded documents.
It would have been possible to mix both schemes indefinitely, and allow the user to choose between "Normal" and "Secure", but I'd rather remove a checkbox/combobox and keep the interface simple.
Deployment
Deployment should be pretty straightforward if you're familiar with running Perl-based CGI applications.There is a sample Apache2 virtual-host file provided, which documents the rewrites which are required to make the application run with clean URLs.
Additionally there is a provided Dockerfile, which allows you to easily build a container with a copy of the project code within it. This container may then be launched to give yourself a local instance of the application in an isolated environment.
There is a pre-built container available from the docker index:
Live Demo
- http://markdownshare.com/,
- https://markdownshare.com/view/9b092e9b-b915-4bfa-92ec-91fc93922fb4
- https://markdownshare.com/view/8aa97665-27bf-478c-afe3-bf2e15a2acee
https://markdownshare.com/faq/
No comments:
Post a Comment