All Projects → albinotonnina → Mmarkdown

albinotonnina / Mmarkdown

Interpret mmd fenced code blocks in a markdown file and generate a cooler version of it.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Mmarkdown

Sinn
a blog based on of react,webpack3,dva,redux,material-ui,fetch,generator,markdown,nodejs,koa2,mongoose,docker,shell,and async/await 基于react+koa2技术栈的个人开源博客系统
Stars: ✭ 175 (+161.19%)
Mutual labels:  markdown, generator
Github Profilinator
🚀 This tool contains mini GUI components that you can hook together to automatically generate markdown code for a perfect readme.
Stars: ✭ 225 (+235.82%)
Mutual labels:  markdown, generator
Jsdoc To Markdown
Generate markdown documentation from jsdoc-annotated javascript
Stars: ✭ 1,199 (+1689.55%)
Mutual labels:  markdown, generator
Markdowngenerator
Swift library to programmatically generate Markdown output and files
Stars: ✭ 76 (+13.43%)
Mutual labels:  markdown, generator
Assemble
Community
Stars: ✭ 3,995 (+5862.69%)
Mutual labels:  markdown, generator
Sourcedocs
Generate Markdown documentation from source code
Stars: ✭ 286 (+326.87%)
Mutual labels:  markdown, generator
Cgx
💻🔥CLI to generate the recommended documentation/files to improve contribution (Github, Gitlab, CodeCommit and Bitbucket)
Stars: ✭ 190 (+183.58%)
Mutual labels:  markdown, generator
Easybook
Book publishing as easy as it should be (built with Symfony components)
Stars: ✭ 744 (+1010.45%)
Mutual labels:  markdown, generator
Docsify Tabs
A docsify.js plugin for rendering tabbed content from markdown
Stars: ✭ 65 (-2.99%)
Mutual labels:  markdown, generator
Github Profile Readme Generator
🚀 Generate GitHub profile README easily with the latest add-ons like visitors count, GitHub stats, etc using minimal UI.
Stars: ✭ 7,812 (+11559.7%)
Mutual labels:  markdown, generator
Verb
HEADS UP! Verb is going though a major transition, we've completely refactored everything from the ground up. If you're interested, please see the dev branch.
Stars: ✭ 442 (+559.7%)
Mutual labels:  markdown, generator
Github Changelog Generator
Automatically generate change log from your tags, issues, labels and pull requests on GitHub.
Stars: ✭ 6,631 (+9797.01%)
Mutual labels:  markdown, generator
Gopdf
pdf document generation library
Stars: ✭ 63 (-5.97%)
Mutual labels:  markdown
Cameron
An avatar generator for Go.
Stars: ✭ 66 (-1.49%)
Mutual labels:  generator
Vue Bl Markdown Editor
一个基于markdown-it 高度可扩展的vue编辑器组件
Stars: ✭ 64 (-4.48%)
Mutual labels:  markdown
Xaringan
Presentation Ninja 幻灯忍者 · 写轮眼
Stars: ✭ 1,129 (+1585.07%)
Mutual labels:  markdown
Guaka
The smartest and most beautiful (POSIX compliant) Command line framework for Swift 🤖
Stars: ✭ 1,145 (+1608.96%)
Mutual labels:  generator
Hexoeditor
this markdown Editor for hexo blog
Stars: ✭ 1,141 (+1602.99%)
Mutual labels:  markdown
Mrdoc
online document system developed based on python. It is suitable for individuals and small teams to manage documents, wiki, knowledge and notes. like gitbook.
Stars: ✭ 1,129 (+1585.07%)
Mutual labels:  markdown
Markra
A Markdown-to-JIRA syntax editor.
Stars: ✭ 64 (-4.48%)
Mutual labels:  markdown

mmarkdown

Codacy Badge

Markdown on caffeine ☕️

Interpret mmd fenced code blocks in a markdown file and generate a cooler version of it.

mmd fenced code block

output:

Hello Jessie

Table of Contents

Demo / Boilerplate / Real world case

The file you are reading right now is generated from this file.

For a kind of boilerplate repo instead, have a look at this repo.

🌎MicheleBertoli/css-in-js

🌎streamich/cross-ci

Install

yarn add mmarkdown --dev

Config package.json (defaults)

{
    "mmarkdown": {
      "src": "./Readme/Readme.md",
      "out": "./Readme.md",
      "scripts": "./Readme/Readme.js",
      "backup": "true",
      "backupPath": "./Readme/backup/"
    }
}
{
  "scripts":{
    "make-readme": "markdown"
  }
}

Command line arguments

argument description default
src Source md file ./ReadmeSrc/Readme.md
out Output md file ./Readme.md
scripts Helper JS file ./ReadmeSrc/Readme.js
backup Do a backup of the output file false
backupPath backup path ./ReadmeSrc/backup/
help Show help
version Show version number
{
  "scripts":{
    "make-readme": "markdown --backup --backupPath ./backupReadme/"
  }
}

Usage

Mmarkdown takes a plain markdown file and generates a copy of it.

It starts to be less boring when you add fenced code blocks with the language identifier set to mmd.

Everything that is returned (as a string) from the code in a block will be interpreted and replaced to the block in the output file.

It's full async, which is cool, lots of awaits are waiting for you there but soon enough you will face a problem: too much code to write in a markdown file! Terrible experience!

The solution in mmarkdown is in the scripts option. The module that the scripts file returns will be passed to the context of the fenced block, see example 3.

The backup option, false by default, will make a copy of the current output file, postfix it with a timestamp and move it into backupPath.

Example 1

mmd fenced code block:

const hello = message => {
  return message
}

return hello('### hippieeeeee hippie yeeeee!!!!!!!!')

output:

hippieeeeee hippie yeeeee!!!!!!!!

Example 2

mmd fenced code block:

const array = [1, 3, 5]

return array.map(item => '#### ' + item).join('\n\n')

output:

1

3

5

Example 3, with Scripts

this script file is passed to mmarkdown with the scripts option:

module.exports = {
  processMyArray: async array =>
    new Promise(resolve => {
      setTimeout(() => {
        resolve(
          array.map(item => ({
            name: item + ' async'
          }))
        )
      }, 1000)
    })
}

mmd fenced code block:

//scripts is passed

const array = [1, 3, 5]

const something = await scripts.processMyArray(array)

const myFinalString = something.map(item => '#### ' + item.name)
  .join('\n\n')

return myFinalString

output:

1 async

3 async

5 async

(The setTimeout is there just for demo purposes)

Maintainers

@albinotonnina

Contribute

PRs accepted.

License

MIT © 2018 Albino Tonnina

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].