Sha256: 69ac5cb9888dd293a86089f5eaa6ccd9e292dc9f409cd61fe3adacc2bad07252
Contents?: true
Size: 1.76 KB
Versions: 5
Compression:
Stored size: 1.76 KB
Contents
# Makeup <a href="http://travis-ci.org/cjohansen/makeup" class="travis"> <img src="https://secure.travis-ci.org/cjohansen/makeup.png"> </a> Makeup provides markup rendering and syntax highlighting in one glorious package. It can also syntax highlight "fenced code blocks" in markdown files. `Makeup` does all its heavylifting through `GitHub::Markup` and `Pygments.rb`, and combines the two for killer code blocks in markup files. ## Markup Rendering markup is done through `Makeup::Markup`. For information about markup formats, what gems to install for various format support etc see the [`GitHub::Markup` docs](https://github.com/github/markup/). ```ruby require "makeup" Makeup::Markup.new.render("file.md", "# Some markdown") ``` `GitHub::Markup` uses the file name to decide what markup format to render the contents with. To extract and syntax highlight "fenced code blocks" with Pygments, give the markup renderer a highlighter: ```ruby require "makeup" highlighter = Makeup::SyntaxHighlighter.new renderer = Makeup::Markup.new(:highlighter => highlighter) renderer.render("file.md", <<MD) # Documentation and examples ## s-trim `(s)` Remove whitespace at the beginning and end of `s`. \`\`\`cl (s-trim "trim ") ;; => "trim" (s-trim " this") ;; => "this" (s-trim " only trims beg and end ") ;; => "only trims beg and end" \`\`\` MD ``` The fenced code block will be syntax highlighted with the common lisp lexer. ## Syntax highlighting `Makeup` provides a very thin abstraction around `Pygments.rb` for syntax highlighting: ```ruby require "makeup" highlighter = Makeup::SyntaxHighlighter.new res = highlighter.highlight(person.rb", <<RUBY) class Person def speak "Hello" end end RUBY res.lexer # "ruby" res.code # HTML-formatted syntax highlighted code ```
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
makeup-0.4.4 | Readme.md |
makeup-0.4.3 | Readme.md |
makeup-0.4.2 | Readme.md |
makeup-0.4.1 | Readme.md |
makeup-0.4.0 | Readme.md |