Markdown as Web Page/Site

  • By Casualwriter
  • Last update: Nov 18, 2022
  • Comments: 2

casual-markdown-page

Casual-Markdown-Page directly use markdown files as web page or web site (ie. markdown-as-webpage).

Just a single html file index.html to load markdown file into web page by the syntax of index.html?file={markdown-file.md}

It is very handy to build simple web-site from markdown files, for example,

Features

  • single html, all-in-one version index-one.html
  • vanilla javascript, no dependence
  • support all browser (include IE9)
  • dark mode
  • responsive, support mobile

Usage Guide

  1. copy index.html or index-one.html to web server
  2. copy index.md and other files (*.md) to the folder

that's it!

  • by default, it will load index.md as home page.
  • hotkey [alt-s] to show markdown html for developer
  • hotkey [alt-k] to showpage in dark mode
  • for mobile, click on title to show/hide TOC.
  • use frontmatter for page configuration (title, menu, navigation), for example
-----------------------------------------------------------------------------
github  : https://github.com/casualwriter/casual-markdown 
title   : Casual-Markdown 
style   : #header { background: RoyalBlue } // additional style, optional
menu    :    
  Home            : index.md
  Supported Syntax: md-syntax.md
  md-as-Doc       : md-as-doc.md
  md-as-Page      : md-as-page.md
  md-as-Blog      : md-as-blog.md
  [DarkMode]      : javascript:darkmode()
-----------------------------------------------------------------------------

## {{ title }} 

[casual-markdown]({{github}}) is a super lightweight RegExp-based markdown parser, 
with TOC and scrollspy support

Modification History

  • 2022/08/11, v0.60, initial release.
  • 2022/08/12, add all-in-one version. index-one.html

Github

https://github.com/casualwriter/casual-markdown-page

Comments(2)

  • 1

    Remote File Inclusion

    Remote File Inclusion

    Remote File Inclusion With Remote File Inclusion (RFI for short), attackers can also integrate remote files that are located on other servers. So it is of course very easy to smuggle in your own code.

    What creates file inclusion vulnerabilities?

    File inclusion security gaps arise when unfiltered variables that may contain user input are passed to the include functions mentioned.

    casual-markdown parser Has great potential, but is unfortunately susceptible to RFI and LFI. Appropriate filters ( ../ // ) should still be installed)

    Demo: https://casualwriter.github.io/casual-markdown/?file=https://raw.githubusercontent.com/PfeifferchsForks/casual-markdown-page/rfi-demo/source/rfi-demo.md and https://casualwriter.github.io/casual-markdown/?file=//raw.githubusercontent.com/PfeifferchsForks/casual-markdown-page/rfi-demo/source/rfi-demo.md

    Unfortunately, my JS knowledge is not sufficient to prepare a pull request with modified code :/

  • 2

    Dark Mode By Default for Single Page

    I am just wondering if there is a way to default a single page the always be the darkmode in the webpage. For example I am using website.com/index.html?file=newpage.md and I would like to know how to load it to dark mode by default without needing to press the Alt+K buttons.