Code Monkey home page Code Monkey logo

phd's Introduction

phd

A Markdown to HTML compiler

euripides

No need for Medical Doctors when you have a Doctor of Philosophy on hand - Gangsta Euripides

NOTE

This tool is currently a Markdown to HTML converter and part of a static blog generator stuffed in one vehicle. I have been meaning to fix this for a long time but haven't gotten around to it just yet. Here are some TODOs:

  • write a (E)BNF grammar for the language Iโ€™m implementing (rather than an informal listing of features)
  • decouple the blog functionality from the Markdown parsing functionality
    • corollary: allow Markdown parsing portion to be used as a header library
  • better error checking
  • tests (pass at least most of John Gruber's Markdown tests)
  • use less ad-hoc parsing techniques
  • become a UNIX filter program (accept from stdin, write to stdout)

Install

  • git clone https://github.com/joshnatis/phd
  • edit the variables in the config() function on top of phd.cpp to configure your settings
  • make
  • Optional: install highlight.js from their page for syntax highlighting in code blocks. If you choose not to install it, make sure to set the USING_HIGHLIGHT_JS flag to false in phd.cpp.

Usage

  • ./phd input.md output.html

Dependencies

c++11 and make

Current features

  • Headings
    • #, ##, ###, ... ######
    • <h1> through <h6>
  • Emphasis
    • **x** or __x__ for bold
    • *x* or _x_ for italic
    • ~~x~~ for strikethrough
    • ==x== for highlight
    • ++x++ for underline
    • ^x^ for superscript
    • ~x~ for subscript
  • Code blocks
    • ```[optional language] <newline> ... <newline> ```
    • automatic syntax highlighting if you link the highlight.js script
  • Inline code
    • `This is inline code`
    • This surrounds the inline code in <code> tags with the class inline-code. You can add styles for .inline-code to change how it looks.
  • Images
    • ![alt](url)
    • ![alt](url)|inline css, e.g. width: 50%; height: 30%|
  • Links
    • [link text](https://url.com)
  • <hr> (horizontal rule)
    • ---
  • Line breaks
    • One or more blank lines between content in the markdown will yield a blank line in the resultant html
    • You can freely use <br> tags
  • Blockquotes
    • > this is all a blockquote
    • Consecutive >'s with no blank lines between will all be funneled into a single blockquote
  • Lists
    • * , + , or - for bulleted lists, 1. (or any number) for numbered lists
    • To nest lists, include two spaces or a tab before your bullet point
  • Escaped characters
    • \>, \&, \<, \*, \_, \^, \~, \`

Missing features (for now)

  • Alternate URL syntax
    • [https://url.com], <url.com>, and/or https://url.com.
  • Nesting different types of lists together is buggy
  • Nesting lists in general is buggy because I misunderstood how nesting lists in HTML works
  • Inline code gets parsed for tags (it should have no formatting)
  • <a> tags get parsed for tags (vry bad, this ruins links)

Missing features (forever)

  • Everything else (wait... there's not much else)

Note From the Author

I didn't use regex, so now I only have 99 problems instead of 2.

Pictures!

I know you want em...

Markdown


HTML


An example blog lives here.

phd's People

Contributors

joshnatis avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  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.