Coder Social home page Coder Social logo

markdown-render's Introduction

Templates for rendering Markdown into HTML. For my very opinionated usage.

Rendering

Server-side

Rendering done via Python-Markdown. Plenty extensions to deal with the fancy stuff, see below. Styling code (.css files) are processed through autoprefixer to add vendor prefxes.

Served files could be prettified via Prettier, but are currently minified using a mix of cssnano, html-minifier and terser.

Extensions

Front matter

Front matter options (in valid YAML v1.1 format) are extracted from any index.md file via regular expression and properly parsed using PyYAML. Supported keys listed below.

The whole front matter block (including --- markers) is removed from the document before processing it.

Metatags

  • author for the article:author metatag;
  • description for the og:description metatag;
  • image for the og:image metatag (above 1200x650 pixels for high resolution screens);
  • date for the article:published_time metatag (YYYY/MM/DD format);
  • tags for the article:tag metatag (list of keywords);
  • title for the og:title metatag (defaults to the name of the folder otherwise);
  • url for the og:url metatag;

Aside from title, all metatags are left empty if absent from the front matter.

Extras

  • canonical to provide the canonical link of the article (defaults to url if not provided).
  • link to provide a link to the author's favourite website.
  • logo to provide a top-bar logo.

Client-side

Once generated, some extra rendering is done in the browser -i.e., on the client- via a couple JavaScript libraries:

  • highlight.js for syntax highlighting.
  • KaTeX to render equations written in LaTeX.
  • Mermaid to render diagrams and flowcharts.

Deploy locally

Run make serve to get the HTTP server started at http://localhost:8000/ using a niftily patched thttpd as a very lightweight solution for local development and testing or the tiny solution shipped with BusyBox, httpd, although still slightly bigger than the thttpd solution previously used.

markdown-render's People

Contributors

carnarez avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.