Skip to content

Latest commit

 

History

History
 
 

docs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Why?

I wanted to create a webpage from Markdown with minimal effort, just through a script tag at the top of a page, and write pure Markdown & it should work right out of the box. There are plenty of alternatives, and for most situations, using something like Jekyll or server-side Markdown will give a more consistent result, but setting this up takes some time/skill.

Use cases

Workflow

  1. Create a github repo
  2. Add a gh-pages branch
  3. Drag and drop pages created using md-pages

How?

Just create a blank file whatever.html and add the script tag (current version <script src="https://cdn.rawgit.com/oscarmorrison/md-page/c72eb9e9/md-page.js"></script><noscript> ) to the top of the page, then write markdown

What markdown?

It uses GitHub flavour markdown https://guides.github.com/features/mastering-markdown/

How does that work?

It's pretty basic, all the custom code lives here https://github.com/oscarmorrison/md-page/blob/master/script.js, but mainly it just adds some style, then uses the incredible https://github.com/showdownjs/showdown to convert text from markdown to HTML and replaces that in the DOM (this is included in the md-page.js file)

Does it do anything else?

Yep. I have added a couple of extra convenience features (mainly for my use case)

Default title

You can manually set a title using the <title> tag. Otherwise, it will use the first dom element (e.g., a header if you start with a header)

Open external urls externally

It modifies any link, and checks it again with the current host; if it's a different link, or not relative, it will add a target="_blank" to the link. All other links with the same hostname, or starting with /, ./, # will not open in a new window.

Add underline to markdown

Not sure why GitHub doesn't have this, but it's nice ___underline___

Styles

This adds some basic styles to the header. Mainly it just changes the font family, and the minimal amount of styles for each of the markdown features

Deeplink to ids

Added a bit of code to be able to deep link to ids in page headers e.g., http://oscarmorrison.com/md-page/#tables

Other resources

Converter library

https://github.com/showdownjs/showdown

List of supported emojis

https://github.com/showdownjs/showdown/wiki/Emojis

More docs