GithubHelp home page GithubHelp logo

gulp-markdown's Introduction

gulp-markdown

Markdown to HTML with marked

Issues with the output should be reported on the marked issue tracker.

Install

npm install --save-dev gulp-markdown

Usage

import gulp from 'gulp';
import markdown from 'gulp-markdown';

export default () => (
	gulp.src('intro.md')
		.pipe(markdown())
		.pipe(gulp.dest('dist'))
);

API

markdown(options?) (default export)

See the marked options.

marked (named export)

Access the marked object to customize the lexer, parser or renderer.

gulp-markdown's People

Contributors

coreyfarrell avatar joswhite avatar mariusgundersen avatar richienb avatar sindresorhus avatar styfle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gulp-markdown's Issues

strong text is incorrectly converted

MARKDOWN:

A local server stack, such as LAMP (**L**inux **A**pache **M**ySQL/**M**ariaDB **P**HP) or WAMP (**W**indows **A**pache **M**ySQL/**M**ariaDB **P**HP)

HTML:

A local server stack, such as LAMP (<strong>L*<em>inux *</em>A</strong>pache <strong>M**ySQL/</strong>M<strong>ariaDB **P</strong>HP) or WAMP (<strong>W*<em>indows *</em>A</strong>pache <strong>M**ySQL/</strong>M<strong>ariaDB **P</strong>HP)

in various online converters, etc. it's ok

marked working with custom renderer, but trying to use custom renderer via markdown fails.

Sorry about this, I have some perfectly working code using marked and I just can't seem to get it to work via gulp-markdown.

Here's the working code:

var log = console.log.bind(console)

var marked = require('marked');
var renderer = new marked.Renderer();
var realTableCellRenderer = renderer.tablecell
renderer.tablecell = function(content, flags){
    flags.align = null;
    return realTableCellRenderer(content, flags)
}

var markdown = `
| API        | Documented CSP Policy           |
| ------------- |:-------------:|
|Google Fonts|No documented policy|
|Mixpanel|No documented policy|
|Ractive.js|[Documented policy](http://docs.ractivejs.org/edge/csp)|
|Stripe|[Documented policy](https://support.stripe.com/questions/what-about-pci-dss-3-1)|
|Twitter oembed API|No documented policy, but [some CSP notes](https://dev.twitter.com/web/overview/widgets-webpage-properties#csp)|
|Typekit|[Documented policy](http://help.typekit.com/customer/portal/articles/1265956-content-security-policy-and-typekit)|
|Stormpath|No documented policy|

`

log(marked(markdown, { renderer: renderer }));

You'll note the output here doesn't contain any style attributes on the td elements. Yaay.

Reading the gulp-markdown and marked docs this seems to be the correct syntax:

// Stop marked spewing CSS into out HTML
var customMarkdownRenderer = new markdown.marked.Renderer();
var realTableCellRenderer = customMarkdownRenderer.tablecell;
customMarkdownRenderer.tablecell = function(content, flags){
    flags.align = null; 
    return realTableCellRenderer(content, flags)
}

And then:

.pipe(markdown({
    renderer: customMarkdownRenderer
}))

How can I use a custom renderer in gulp-markdown?

Please help with convert from .md to .html

I would like convert all .md to .html, I have setup the gulpfile.js as below, after run gulp, the result doesn't contain the , , something like that, how to setup the option to include them, also is it possible to setup other things such as the <title>.

I really don't understand about using "marked" as option I really new to node.js and gulp, may be you could me some example of passing option to "marked".

var gulp = require('gulp');
var markdown = require('gulp-markdown');

gulp.task('markdown', function () {
gulp.src('*.md')
.pipe(markdown())
.pipe(gulp.dest(''));
});

Thanks.

GFM and syntax highlighting?

I haven't been able to get gfm tables and syntax highlighting to work...

Here's my gulpfile:

var gulp = require('gulp');
var markdown = require('gulp-markdown');
var livereload = require('gulp-livereload');

gulp.task('markdown', function() {
  return gulp.src('*.md')
      .pipe(markdown({
        highlight: function(code) {
          return require('highlight.js').highlightAuto(code).value;
        }
      }))
      .pipe(gulp.dest('./'))
      .pipe(livereload());
});

gulp.task('watch', function() {
  livereload.listen();
  gulp.watch('*.md', ['markdown']);
});

.html extension instead of .md

Any way to apply .html as the file extension?

gulp.src('./src/**/*.md')
.pipe(markdown())
.pipe(gulp.dest('./dest/'))

The above results in successfully compiled html files but with the .md extension.

Thanks

Expose marked object

It would be neat if this plugin could expose the marked object it is using, so it can be modified. marked exposes (for example) the Renderer class which is useful to modify with custom rendering. This is not possible using only this plugin now, but requires only a single line of code to make possible.

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.