Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run markdown on my website?

Tags:

markdown

Apologies, if this question is somewhat basic, but research on internet has not yielded any reasonable answers. I want to be able to run markdown on my website, similar to what github has (edit/preview setup) or actually something very similar to stackoverflow. I found a number of articles on the history of markdown including: [

  • Daring Firebal which does not provide more info
  • Life hacker's article which allows running MD on your local machine using a perl script
  • Coding Horror - with a project of great ambition, yet still not explaining how I can run their version of MD on my website

And a few more sources. Some allow writing markdown online and sync to gdrive, but again that's not what I'm looking for.

I'm not looking to creating my own flavor, I particularly like Stackedit because it allows flowcharts.

Do I need a "markdown server"?

like image 968
PBD10017 Avatar asked Nov 26 '15 22:11

PBD10017


People also ask

How do I use Markdown on my website?

Use a static site generator. This requires you to install a piece of software on your local machine, and then organize your Markdown files in a particular manner (along with a template and theme, etc). Then you would run a command-line script which would convert all your Markdown files to HTML files.

How do you run Markdown?

Tip: You can also right-click on the editor Tab and select Open Preview (Ctrl+Shift+V) or use the Command Palette (Ctrl+Shift+P) to run the Markdown: Open Preview to the Side command (Ctrl+K V).

How do you integrate a Markdown in HTML?

document. createElement("markdown"); var md_tags = document. getElementsByTagName("markdown"); // Returns array of all markdown tags. for (var i = 0; i < md_tags.

Can I use Markdown instead of HTML?

Markdown is easier to write than HTML, and it's easier for most humans to read Markdown source than HTML source. However, HTML is more expressive (particularly regarding semantic tagging) and can achieve some specific effects that might be difficult or impossible in Markdown.


1 Answers

There are a number of ways in which you can 'run Markdown' on your website. For a large part, it depends on your web server's environment. Below is a basic summary of the options:

  • Run a traditional 'live' server.

    In this scenario, each request made to the server runs a script which retrieves the Markdown text, converts it to HTML, does some possible post-prepossessing (running through a templating system), and then returns the HTML at an HTTP response.

    This could be as simple as writing a CGI script, or as complicated as using a (server side) web framework. In either case, the available options will depend on which server you are running, which scripting languages you have valuable, which Markdown implementation you want to use and the list goes on.

  • Use a static site generator.

    This requires you to install a piece of software on your local machine, and then organize your Markdown files in a particular manner (along with a template and theme, etc). Then you would run a command-line script which would convert all your Markdown files to HTML files. You can then upload those files to a 'flat file server' (almost any web server will do), and your files will be served much more efficiently. Next time you want to make edits/additions, just make the changes to your local Markdown files and run the script again and re-upload. Some of the more advanced scripts will even automate the uploading for you. You can find a few lists of such packages with a quick search.

As SO is not the place to make tool recommendations, that is about all the help I can provide. If you can narrow down which approach you want to take,then you should be able to narrow your research. For tool recommendations, try Software Recs.

like image 102
Waylan Avatar answered Oct 09 '22 01:10

Waylan