Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const engine = require('unified-engine');
const options = require('unified-args/lib/options');
const extensions = require('markdown-extensions');
const processor = require('remark');
const proc = require('remark/package.json');
const cli = require('../package.json');
const { plugins } = require('remark-preset-lint-node');
const args = {
processor: processor,
name: proc.name,
description: cli.description,
version: [
proc.name + ': ' + proc.version,
cli.name + ': ' + cli.version,
].join(', '),
ignoreName: '.' + proc.name + 'ignore',
extensions: extensions
};
const config = options(process.argv.slice(2), args);
config.detectConfig = false;
config.plugins = plugins;
engine(config, (err, code) => {
if (err) console.error(err);
process.exit(code);
});
import React from 'react';
import defaultParserInterface from '../utils/defaultParserInterface';
import pkg from 'remark/package.json';
const ID = 'remark';
export default {
...defaultParserInterface,
id: ID,
displayName: ID,
version: pkg.version,
homepage: pkg.homepage,
locationProps: new Set(['position']),
loadParser(callback) {
require(['remark'], callback);
},
parse(remark, code, options) {
return remark()
.data('settings', options)
.parse(code);
},
nodeToRange({position}) {
if (position) {
return [position.start.offset, position.end.offset];