Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonschlinkert/gfm-code-blocks
Extract gfm (GitHub Flavored Markdown) fenced code blocks from a string.
https://github.com/jonschlinkert/gfm-code-blocks
blocks code gfm github-flavored-markdown markdown parser
Last synced: about 2 months ago
JSON representation
Extract gfm (GitHub Flavored Markdown) fenced code blocks from a string.
- Host: GitHub
- URL: https://github.com/jonschlinkert/gfm-code-blocks
- Owner: jonschlinkert
- License: mit
- Created: 2014-08-13T09:54:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-16T15:52:05.000Z (almost 8 years ago)
- Last Synced: 2024-10-25T03:22:37.702Z (2 months ago)
- Topics: blocks, code, gfm, github-flavored-markdown, markdown, parser
- Language: JavaScript
- Homepage: https://github.com/jonschlinkert
- Size: 40 KB
- Stars: 20
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gfm-code-blocks [![NPM version](https://img.shields.io/npm/v/gfm-code-blocks.svg?style=flat)](https://www.npmjs.com/package/gfm-code-blocks) [![NPM monthly downloads](https://img.shields.io/npm/dm/gfm-code-blocks.svg?style=flat)](https://npmjs.org/package/gfm-code-blocks) [![NPM total downloads](https://img.shields.io/npm/dt/gfm-code-blocks.svg?style=flat)](https://npmjs.org/package/gfm-code-blocks) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/gfm-code-blocks.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/gfm-code-blocks)
> Extract gfm (GitHub Flavored Markdown) fenced code blocks from a string.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save gfm-code-blocks
```## Usage
```js
var codeBlocks = require('gfm-code-blocks');
console.log(codeBlocks('usage\n```js\nvar qux = 123;\n```\nxyz'));
//=> {lang: 'js',
// code: 'var qux = 123;',
// block: '```js\nvar qux = 123;\n```',
// start: 6,
// end: 30}
```## About
### Related projects
* [gfm-code-block-regex](https://www.npmjs.com/package/gfm-code-block-regex): RegExp for gfm (GitHub Flavored Markdown) fenced code blocks. | [homepage](https://github.com/regexhq/gfm-code-block-regex "RegExp for gfm (GitHub Flavored Markdown) fenced code blocks.")
* [markdown-toc](https://www.npmjs.com/package/markdown-toc): Generate a markdown TOC (table of contents) with Remarkable. | [homepage](https://github.com/jonschlinkert/markdown-toc "Generate a markdown TOC (table of contents) with Remarkable.")
* [prettify-markdown](https://www.npmjs.com/package/prettify-markdown): Prettify, format or beautify your markdown. Whatever you want to call it, this does that… [more](https://github.com/jonschlinkert/prettify-markdown) | [homepage](https://github.com/jonschlinkert/prettify-markdown "Prettify, format or beautify your markdown. Whatever you want to call it, this does that. Used on hundreds of projects by verb.")
* [remarkable](https://www.npmjs.com/package/remarkable): Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in… [more](https://github.com/jonschlinkert/remarkable) | [homepage](https://github.com/jonschlinkert/remarkable "Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in one.")### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 16 | [jonschlinkert](https://github.com/jonschlinkert) |
| 3 | [tunnckoCore](https://github.com/tunnckoCore) |### Building docs
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```### Running tests
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
$ npm install && npm test
```### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.3, on March 16, 2017._