New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fullstackio/cqmd

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fullstackio/cqmd - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

test/data/basic.expected.md

14

dist/cli.js

@@ -23,13 +23,4 @@ #!/usr/bin/env node

/*
Thoughts:
The idea: a markdown preprocessor that parses cq directives and replaces them with code blocks
The options
- root dir - the patch by which the paths are relative to
- the flavor of code blocks, for now gfm
* A markdown preprocessor that parses cq directives and replaces them with code blocks
*/
var argv = _yargs2.default.usage('Usage: $0 [options] <file>').example("$0 post.md", "process post.md and emit the results on STDOUT").help('help').alias('help', 'h').option('output', {

@@ -46,3 +37,4 @@ alias: 'o',

describe: 'the format to convert codeblocks into',
choices: ['gfm', 'block', 'leanpub'],
// choices: ['gfm', 'block', 'leanpub', 'raw'],
choices: ['gfm', 'raw'],
default: 'gfm'

@@ -49,0 +41,0 @@ }).argv;

@@ -63,2 +63,8 @@ 'use strict';

function formatRaw(results) {
var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
return results.code + '\n';
}
function cqmd(text) {

@@ -82,2 +88,7 @@ var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

// blocks override the global setting
if (blockOpts['format']) {
opts.format = blockOpts['format'];
}
var fullFilename = _path2.default.join(opts.path, actualName);

@@ -88,2 +99,6 @@ var contents = _fs2.default.readFileSync(fullFilename).toString();

if (typeof opts.format === "function") {
return opts.format(cqResults, blockOpts);
}
switch (opts.format) {

@@ -93,2 +108,5 @@ case 'gfm':

break;
case 'raw':
replacement = formatRaw(cqResults, blockOpts);
break;
default:

@@ -95,0 +113,0 @@ throw new Error('unknown format: ' + opts.format);

{
"name": "@fullstackio/cqmd",
"version": "1.0.0",
"version": "1.0.1",
"description": "markdown pre-processor for cq",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -29,2 +29,4 @@ # cqmd: A markdown preprocessor for cq code blocks [![Dolpins](https://cdn.rawgit.com/fullstackio/cq/master/doc/readme/dolphins-badge-ff00ff.svg)](https://www.fullstackreact.com)

If you'd like to create a custom formatting function, use the `format` key in the options.
## Future

@@ -34,3 +36,2 @@

- Support [leanpub-style `crop-start-line`](https://leanpub.com/help/manual#leanpub-auto-displaying-only-part-of-a-code-file) blocks
- Add a callback for custom formatting

@@ -37,0 +38,0 @@ ## Contributing

@@ -8,13 +8,4 @@ #!/usr/bin/env node

/*
Thoughts:
The idea: a markdown preprocessor that parses cq directives and replaces them with code blocks
The options
- root dir - the patch by which the paths are relative to
- the flavor of code blocks, for now gfm
* A markdown preprocessor that parses cq directives and replaces them with code blocks
*/
let argv = yargs

@@ -38,3 +29,4 @@ .usage('Usage: $0 [options] <file>')

describe: 'the format to convert codeblocks into',
choices: ['gfm', 'block', 'leanpub'],
// choices: ['gfm', 'block', 'leanpub', 'raw'],
choices: ['gfm', 'raw'],
default: 'gfm'

@@ -41,0 +33,0 @@ })

@@ -40,2 +40,6 @@ /**

function formatRaw(results, opts={}) {
return results.code + '\n';
}
export default function cqmd(text, opts={}) {

@@ -52,2 +56,7 @@ opts.format = opts.format || 'gfm';

// blocks override the global setting
if(blockOpts['format']) {
opts.format = blockOpts['format'];
}
let fullFilename = path.join(opts.path, actualName);

@@ -58,2 +67,6 @@ let contents = fs.readFileSync(fullFilename).toString();

if(typeof opts.format === "function") {
return opts.format(cqResults, blockOpts);
}
switch(opts.format) {

@@ -63,2 +76,5 @@ case 'gfm':

break;
case 'raw':
replacement = formatRaw(cqResults, blockOpts);
break;
default:

@@ -65,0 +81,0 @@ throw new Error('unknown format: ' + opts.format);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc