Coder Social home page Coder Social logo

broccoli-md-to-json's Introduction

Broccoli MD to JSON

Converts each individual markdown files into an individual json file. This plugin also generates an index.json containing a selected set of data from all markdown files.

! This is a work in progress !

This plugin is part of my workflow to use Ember-Cli without a back-end, for prototyping purposes. More info coming up soon.

Installation

This plugin isn't published on npm (yet). To use this, install using the tarball url npm install <tarball url>

npm install https://github.com/emache/broccoli-md-to-json/tarball/v0.0.1 --save-dev  

Description

If the structure of all your markdown files is as follow:

title: This project has a fancy title
author: Jimmy
headline: Because it's so special
anyOtherProperty: Add as many property as you like and name them as you like.
---

### Content text here

The plugin will create a Json file looking like this for each markdown file:

{"title":"This project has a fancy title","author":"Jimmy","headline":"Because it's so special","description":"<h3>Content text here</h3>"}

AND it will generate an index.json file which contains information for all the markdown file. Which information is included in the file is controlled through the plugin options. A slug property is also generated using the original markdown file name.

[{"title":"This project has a fancy title", "author":"Jimmy","headline":"Because it's so special","slug":"project-1-name"}]

Usage

Setting the plugin in your Brocfile.js should be:

var md2json = require('broccoli-md-to-json');

var convertedFiles = md2json('./data', {
    inputFiles: ['*.md'],
    destDir: 'api/projects/',
    indexData: ['title', 'author', 'headline']
});

module.exports = convertedFiles;

Choose indexData based on the structure of your markdown files.

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.