Skip to content
Permalink
Browse files
add markdown
  • Loading branch information
parshimers committed Oct 17, 2015
1 parent 79e14d2 commit d9e597c2e3ef6ce3f0f636dc46209ef0a5c0a179
Showing 165 changed files with 22,155 additions and 0 deletions.
@@ -0,0 +1,35 @@
url: https://asterixdb.incubator.apache.org/

name: "Apache AsterixDB"

STABLE_VERSION: 0.8.6
UNSTABLE_VERSION: 0.8.7-SNAPSHOT
STABLE_DOWNLOAD_URL: "http://asterixdb.ics.uci.edu/download/0.8.6/asterix-installer-0.8.6-binary-assembly.zip"
UNSTABLE_DOWNLOAD_URL: "https://asterix-jenkins.ics.uci.edu/job/asterix-test-full/lastStableBuild/org.apache.asterix$asterix-installer/artifact/org.apache.asterix/asterix-installer/0.8.7-SNAPSHOT/asterix-installer-0.8.7-SNAPSHOT-binary-assembly.zip"
STABLE_YARN_URL: ""
UNSTABLE_YARN_URL: "https://asterix-jenkins.ics.uci.edu/job/asterix-test-full/lastStableBuild/org.apache.asterix$asterix-yarn/artifact/org.apache.asterix/asterix-yarn/0.8.7-SNAPSHOT/asterix-yarn-0.8.7-SNAPSHOT-binary-assembly.zip"
DOCS_BASE_URL: "http://asterixdb.ics.uci.edu/documentation"
UNSTABLE_DOCS_BASE_URL: "https://asterix-jenkins.ics.uci.edu/job/asterix-test-full/site/asterix-doc"
ICS_DOWNLOAD_BASE_URL: "https://asterixdb.ics.uci.edu/download"

# Build settings
defaults:
-
scope:
path: ""
values:
layout: plain

markdown: kramdown
highlighter: pygments

kramdown:
toc_levels: 1..3
input: GFM
hard_wrap: false

redcarpet:
extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink",
"tables", "with_toc_data", "strikethrough", "superscript",
"lax_spacing"]

@@ -0,0 +1,46 @@
<div class="masthead">
<p class="lead">
<a href="{{ site.url }}index.html"><img src="{{ site.url }}img/asterixdb.png" style="height:75px; width:auto; vertical-align:bottom; margin-top:10px;"/></a>
</p>
</div>

<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ site.url }}index.html">Overview</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="{{ site.url }}download.html">Download</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Documentation<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li class="dropdown-header">Stable release</li>
<li><a href="{{ site.DOCS_BASE_URL }}/index.html">Documentation for {{ site.STABLE_VERSION }}<i class="fa fa-external-link fa-sm"></i></a></li>
<li class="divider"></li>
<li class="dropdown-header">Snapshot release</li>
<li><a href="{{ site.UNSTABLE_DOCS_BASE_URL }}/index.html">Documentation for {{ site.UNSTABLE_VERSION }} <i class="fa fa-external-link fa-sm"></i></a></li>
</ul>
</li>
<li><a href="{{ site.url }}about.html">About</a></li>
<li><a href="{{ site.url }}community.html">Community</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Contributing <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li class="dropdown-header">For New Contributors</li>
<li><a href="{{ site.url }}dev-setup.html">Development Setup</a></li>
<li class="divider"></li>
<li class="dropdown-header">For Committers</li>
<li><a href="{{ site.url }}pushing.html">Pushing changes</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="{{ site.url }}favicon.ico">

<title>{{ page.title }}</title>

<!-- Bootstrap core CSS -->
<link href="{{ site.url }}css/bootstrap.min.css" rel="stylesheet">
<!-- Bootstrap theme -->

<!-- Custom styles for this template -->
<link href="{{ site.url }}css/theme.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>

<div class="container theme-showcase" role="main">
{% include nav_header.html %}

{{ content }}

<hr />

<footer>
<div class="row">
<div class="col-md-6 col-md-offset-3 text-center">
<p>&copy; Copyright 2015 The Apache Software foundation. All Rights Reserved. </p>
<p>Apache AsterixDB, Apache, and the Apache feather logo are trademarks of the Apache Software Foundation</p>
</div>
<div class="col-md-1 text-right">
<img src="{{ site.url }}img/egg-logo.png" style="height:auto; width:200px; vertical-align:bottom;"/>
</div>
</div>
</footer>
</div> <!-- /container -->


<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="{{ site.url }}js/bootstrap.min.js"></script>
</body>
</html>
@@ -0,0 +1,9 @@
---
layout: default
---
<div class="row">
<div class="col-md-8 col-centered">
<h2>{{ page.title }}</h2>
{{content}}
</div>
</div>
@@ -0,0 +1,9 @@
---
layout: default
---
<div class="row">
<div class="col-md-10 col-centered">
<h2>{{ page.title }}</h2>
{{content}}
</div>
</div>
@@ -0,0 +1,70 @@
Kramdown with Pygments
========
A Jekyll plugin that enables Pygments syntax highlighting for Kramdown-parsed fenced code blocks.
Heavily based on [krampygs](https://github.com/navarroj/krampygs), but refactored to make it work with Jekyll 2.*.

In the standard setup, Jekyll Kramdown only works with Pygments for syntax highlighting
when you use Liquid tags. This plugin makes Kramdown also use Pygments when using
fenced code blocks. That way you can use more Markdown and less Liquid. Yay!

## Usage

* Clone this project into your `_plugins` directory.
* Add the following lines to your `_config.yml`

```yaml
markdown: KramdownPygments
```

Fenced code blocks can now be syntax highlighted using the power of Pygments.


~~~php
print "Hello World"
~~~


The same goes for inline code:

You could also do something like this: `var foo = 'bar'`{:.language-javascript}. Amazing!

## Setting the default language
If you don't want to set the language for inline code blocks like that every time,
you can define a global default language for the entire site in your `_config.yml`

```yaml
kramdown:
default_lang: php
```

If you want to override that for a single page, add the following at the top of
that page, but below the front-matter

```
{::options kramdown_default_lang="php" /}
```

## Options
This plugin supports all options that the original kramdown converter supports:

```yaml
kramdown:
auto_ids: true
footnote_nr: 1
entity_output: as_char
toc_levels: 1..6
smart_quotes: lsquo,rsquo,ldquo,rdquo
input: GFM
```

## Tested with

* kramdown 1.4.0
* pygments.rb 0.6.0
* jekyll 2.1.1
* ruby 2.0.0p451

## Thanks

This plugin is heavily based on [krampygs](https://github.com/navarroj/krampygs).
Thanks to [@navarroj](https://github.com/navarroj) for developing the original plugin.
@@ -0,0 +1,92 @@
# We define the an additional option for the kramdown parser to look for
module Kramdown
module Options
define(:kramdown_default_lang, Symbol, nil, <<EOF)
Sets the default language for highlighting code blocks
If no language is set for a code block, the default language is used
instead. The value has to be one of the languages supported by pygments
or nil if no default language should be used.
Default: nil
Used by: PygmentsHtml converter
EOF
end
end

# This class is a plugin for kramdown, to make it use pygments instead of coderay
# It has nothing to do with Jekyll, it is simply used by the custom converter below
module Kramdown
module Converter
class PygmentsHtml < Html

begin
require 'pygments'
rescue LoadError
STDERR.puts 'You are missing a library required for syntax highlighting. Please run:'
STDERR.puts ' $ [sudo] gem install pygments'
raise FatalException.new("Missing dependency: Pygments")
end

def convert_codeblock(el, indent)
attr = el.attr.dup
lang = extract_code_language!(attr) || @options[:kramdown_default_lang]
code = pygmentize(el.value, lang)
code_attr = {}
code_attr['class'] = "language-#{lang}" if lang
"#{' '*indent}<div class=\"highlight\"><pre#{html_attributes(attr)}><code#{html_attributes(code_attr)}>#{code}</code></pre></div>\n"
end

def convert_codespan(el, indent)
attr = el.attr.dup
lang = extract_code_language!(attr) || @options[:kramdown_default_lang]
code = pygmentize(el.value, lang)
if lang
attr['class'] = "highlight"
if attr.has_key?('class')
attr['class'] += " language-#{lang}"
else
attr['class'] = "language-#{lang}"
end
end
"<code#{html_attributes(attr)}>#{code}</code>"
end

def pygmentize(code, lang)
if lang
Pygments.highlight(code,
:lexer => lang,
:options => { :startinline => true, :encoding => 'utf-8', :nowrap => true })
else
escape_html(code)
end
end
end
end
end

# This class is the actual custom Jekyll converter.
class Jekyll::Converters::Markdown::KramdownPygments

def initialize(config)
require 'kramdown'
@config = config
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install kramdown'
raise FatalException.new("Missing dependency: kramdown")
end

def convert(content)
html = Kramdown::Document.new(content, {
:auto_ids => @config['kramdown']['auto_ids'],
:footnote_nr => @config['kramdown']['footnote_nr'],
:entity_output => @config['kramdown']['entity_output'],
:toc_levels => @config['kramdown']['toc_levels'],
:smart_quotes => @config['kramdown']['smart_quotes'],
:kramdown_default_lang => @config['kramdown']['default_lang'],
:input => @config['kramdown']['input']
}).to_pygments_html
return html;
end
end

0 comments on commit d9e597c

Please sign in to comment.