Giter Site home page Giter Site logo

mocoso / docter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alampros/docter

0.0 2.0 0.0 117 KB

Get that restaurant github flavor at home in your editor.

Home Page: http://alampros.github.com/Docter

Ruby 30.64% JavaScript 5.90% CSS 63.46%

docter's Introduction

#Docter

Get that restaurant github flavor at home in your editor.

Screenshot

Uses github's own redcarpet library to provide accurate markdown previews in your local editor. This screenshot shows Marked using docter as the markdown processor.

##Changes

###2012-01-17

  • Updated styles to match new GitHub styles
  • Updated gfm wrapper for Redcarpet 2
  • Removed nokigiri and albino dependencies
  • Using pygments.rb wrapper instead

##GitHub Flavored Markdown Extensions Supported:

  • Fenced codeblocks

     var awesome = new BadassClass (param) {
     	return "string"
     }
  • Strikethru support

  • Syntax highlighting via pygments

     require 'redcarpet'
     def markdown(text)
       options = [:fenced_code,:generate_toc,:hard_wrap,:no_intraemphasis,:strikethrough,:gh_blockcode,:autolink,:xhtml,:tables]
       html = Redcarpet.new(text, *options).to_html 
       syntax_highlighter(html)
     end
  • www.auto-linking.com

  • table support

    First Header Second Header
    Content Cell Content Cell
    Content Cell Content Cell

#Why NodeJS and not ruby?

I have future plans for this in a node project. And because it's my party.

#Requirements

Lots. Ungodly heaps of requirements.

  • NodeJS and NPM if you plan on using the node wrapper.

  • Ruby & Rubygems

  • Various gems

     $ gem install redcarpet pygments.rb

#Usage

  1. Clone this repo locally
  2. cd to the repo
  3. [sudo] npm -g install

This will install the package into your global node_modules dir (usually /usr/local/lib/node_modules). It will also symbolically link two executables into your path:

  1. docter: the nodejs wrapper.
  2. gfm: the ruby redcarpet/pygments wrapper.

Both of these executables take markdown input through STDIN and output formatted HTML on STDOUT.

##Using with Marked.app

  1. Set the markdown processor to either of the linked executables. If you don't plan on doing anything with the node wrapper, I would suggest using the straight ruby wrapper (gfm).
  2. Optionally, add the ghf_marked.css (in this repo) to Marked's custom CSS list.

#Other styles

Uncomment the doc_header() function in github-flavored-markdown.rb and include any of the built-in styles from pygments. Replace :style => 'vs' with one of the styles in the comment block.

Outputting the emacs style to the document header:

class HTMLwithPygments < Redcarpet::Render::XHTML
	def doc_header()
		'<style>' + Pygments.css('.highlight',:style => 'emacs') + '</style>'
	end
	def block_code(code, language)
		Pygments.highlight(code, :lexer => language, :options => {:encoding => 'utf-8'})
	end
end

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.