Giter Site home page Giter Site logo

markx's Introduction

markx

markx converts markdown with code snippets into html. It also has options to pass in a template file and data. It is great for building github pages and creating blog posts from markdown files.

##Installation

Inside a project:

npm install markx --save

Globally:

npm install markx -g

##CLI Usage

markx input.md [opts]

Options:

Options:
  -t, --template   HTML template file                                        
  -l, --highlight  Enable or disable syntax highlighting 
  -d, --data       JSON|YAML data file that gets passed to input and template
  -h, --help       Show help info  

##API Usage

var markx = require('markx');

markx({
	input: 'input.md', //can be either a filepath or a source string
	template: 'layout.html', //can either be filepath or source string
	highlight: true, //parse code snippets for syntax highlighters, default: true
	data: {} //data that gets passed into template
}, function(err, html) {
});

##Example

###Command

markx.js readme-example.md --template readme-example-template.html --data readme-example.json 

###Markdown

#This is a heading

This is a paragraph

```javascript
var a = '123';
var f = function() {
	return 4;
}
```

###Template

<!DOCTYPE html>
<html lang="en">
  <meta charset="utf-8" />
  <head>
    <title><%= pageTitle %></title>
  </head>
  <body>
    <header>Logo</header>
    <section>
      <%- body %>
    </section>
    <footer>Footer</footer>
  </body>
</html>

###Data

{
  "pageTitle": "This is the page title"
}

###Output

<!DOCTYPE html>
<html lang="en">
  <meta charset="utf-8" />
  <head>
    <title>This is the page title</title>
  </head>
  <body>
    <header>Logo</header>
    <section>
      <h1>This is a heading</h1>
<p>This is a paragraph

</p>
<pre><code class="lang-javascript"><span class="keyword">var</span> a = <span class="string">'123'</span>;
<span class="keyword">var</span> f = <span class="keyword">function</span>() {
    <span class="keyword">return</span> <span class="number">4</span>;
}</code></pre>

    </section>
    <footer>Footer</footer>
  </body>
</html>

##History

View History

##Development and Tests

npm install
./node_modules/.bin/grunt

markx's People

Contributors

jgallen23 avatar nick-thompson avatar sjwilliams 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.