How to use the setOptions function from marked

Find comprehensive JavaScript marked.setOptions code examples handpicked from public code repositorys.

29
30
31
32
33
34
35
36
37
38
var distReadme = join(build, 'dist', grunt.config.get('pkg.name'), 'README.txt');

var srcLicense =  join(root, 'LICENSE.md');
var distLicense = join(build, 'dist', grunt.config.get('pkg.name'), 'LICENSE.txt');

marked.setOptions({
  renderer: new TextRenderer(),
  tables: true,
  breaks: false,
  pedantic: false,
fork icon118
star icon0
watch icon2

2802
2803
2804
2805
2806
2807
2808
2809
2810
2811

    if (hasExtensions) {
      opts.extensions = extensions;
    }

    marked.setOptions(opts);
  });
};
/**
 * Run callback for every token
fork icon2
star icon3
watch icon0

+ 7 other calls in file

221
222
223
224
225
226
227
228
229
230

function belmark (source = '', ...values) {
  source = [].concat(source)
  var opts = this || {}

  marked.setOptions(opts)
  var _class = opts.classname || 'markdown'
  var _id = '{{'+Math.random()+'}}'
  var _source = marked(source.join(_id)).split(_id)
  var _values = values.map((v,i) => 'values['+i+']').concat()
fork icon2
star icon0
watch icon2

819
820
821
822
823
824
825
826
827
828
var mdConf = config.markdown || {};

if (isFn(mdConf)) {
  compile = mdConf(marked, renderer);
} else {
  marked.setOptions(
    merge(mdConf, {
      renderer: merge(renderer, mdConf.renderer),
    })
  );
fork icon0
star icon2
watch icon0

1522
1523
1524
1525
1526
1527
1528
1529
1530
        }
    }
}

// Set options
marked.setOptions(markedOptions)

// Convert the markdown to HTML
var htmlText = marked(text)
fork icon0
star icon0
watch icon1