Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

marksy

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marksy - npm Package Compare versions

Comparing version 6.0.2 to 6.0.3

.eslintrc.js

2

components.js

@@ -1,1 +0,1 @@

module.exports = require('./lib/components')
module.exports = require('./lib/components');

@@ -12,6 +12,2 @@ 'use strict';

var _createRenderer = require('./createRenderer');
var _createRenderer2 = _interopRequireDefault(_createRenderer);
var _marked = require('marked');

@@ -23,2 +19,6 @@

var _createRenderer = require('./createRenderer');
var _createRenderer2 = _interopRequireDefault(_createRenderer);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -31,2 +31,3 @@

// eslint-disable-next-line no-param-reassign
options.components = options.components || {};

@@ -44,5 +45,10 @@

try {
var code = (0, _babelStandalone.transform)(_html, {
// eslint-disable-next-line no-plusplus
var elementId = tracker.nextElementId++;
var _transform = (0, _babelStandalone.transform)(_html, {
presets: ['react']
}).code;
}),
code = _transform.code;
var components = Object.keys(options.components).map(function (key) {

@@ -55,3 +61,7 @@ return options.components[key];

var componentProps = components.indexOf(tag) >= 0 ? Object.assign(props || {}, { key: tracker.nextElementId++, context: tracker.context }) : props;
var componentProps = components.indexOf(tag) >= 0 ? Object.assign(props || {}, {
// eslint-disable-next-line no-plusplus
key: tracker.nextElementId++,
context: tracker.context
}) : props;

@@ -66,4 +76,13 @@ for (var _len = arguments.length, children = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {

tracker.tree.push(new (Function.prototype.bind.apply(Function, [null].concat(['React'], _toConsumableArray(Object.keys(options.components)), ['return ' + code])))().apply(undefined, [mockedReact].concat(_toConsumableArray(components))) || null);
} catch (e) {}
tracker.elements[elementId] =
// eslint-disable-next-line no-new-func
new (Function.prototype.bind.apply(Function, [null].concat(['React'], _toConsumableArray(Object.keys(options.components)), ['return ' + code])))().apply(undefined, [mockedReact].concat(_toConsumableArray(components))) || null;
tracker.tree.push(tracker.elements[elementId]);
return '{{' + elementId + '}}';
} catch (e) {
//
}
return null;
},

@@ -73,5 +92,4 @@ code: function code(_code, language) {

return renderer.html(_code);
} else {
return (0, _createRenderer.codeRenderer)(tracker, options)(_code, language);
}
return (0, _createRenderer.codeRenderer)(tracker, options)(_code, language);
}

@@ -95,4 +113,2 @@ });

}
;
//# sourceMappingURL=components.js.map

@@ -21,3 +21,5 @@ 'use strict';

function CodeComponent(props) {
return options.createElement('pre', null, options.createElement('code', {
return options.createElement('pre', null,
// eslint-disable-next-line react/no-danger-with-children
options.createElement('code', {
className: 'language-' + props.language,

@@ -29,4 +31,6 @@ dangerouslySetInnerHTML: options.highlight ? { __html: options.highlight(props.language, props.code) } : null

return function (code, language) {
// eslint-disable-next-line no-plusplus, no-param-reassign
var elementId = tracker.nextElementId++;
// eslint-disable-next-line no-param-reassign
tracker.elements[elementId] = options.createElement(options.elements && options.elements.code || CodeComponent, { key: elementId, code: code, language: language });

@@ -47,8 +51,9 @@

var currentLevel = toc.children;
// eslint-disable-next-line no-constant-condition
while (true) {
if (!currentLevel.length || currentLevel[currentLevel.length - 1].level === level) {
return currentLevel;
} else {
currentLevel = currentLevel[currentLevel.length - 1].children;
}
currentLevel = currentLevel[currentLevel.length - 1].children;
}

@@ -66,3 +71,3 @@ }

return tracker.elements[elementIdMatch[1]];
} else if (text != '') {
} else if (text !== '') {
return _he2.default.decode(text);

@@ -82,2 +87,3 @@ }

// eslint-disable-next-line no-plusplus, no-param-reassign
var elementId = tracker.nextElementId++;

@@ -92,2 +98,3 @@ var inlineContent = null;

// eslint-disable-next-line no-param-reassign
tracker.elements[elementId] = options.createElement(elementType || tag, Object.assign({

@@ -105,2 +112,3 @@ key: elementId

renderer.html = overrides.html || function (html) {
// eslint-disable-next-line no-plusplus, no-param-reassign
var elementId = tracker.nextElementId++;

@@ -149,2 +157,3 @@

renderer.heading = overrides.heading || function (text, level) {
// eslint-disable-next-line no-param-reassign
tracker.currentId = tracker.currentId.slice(0, level - 1);

@@ -151,0 +160,0 @@ tracker.currentId.push(text.replace(/\s/g, '-').toLowerCase());

@@ -50,4 +50,2 @@ 'use strict';

}
;
//# sourceMappingURL=index.js.map
{
"name": "marksy",
"version": "6.0.2",
"version": "6.0.3",
"description": "Convert markdown into react components",
"main": "lib/index.js",
"scripts": {
"start": "webpack-dev-server --devtool eval-source-map --progress --colors --content-base build",
"prepare": "npm run build",
"build": "BABEL_ENV=production babel src/ --out-dir=lib/ -s",
"test": "jest && size-limit",
"size": "size-limit"
},
"repository": {
"type": "git",
"url": "https://github.com/cerebral/marksy"
},
"keywords": [
"react",
"convert",
"markdown",
"convert"
"react"
],
"author": "Christian Alfoni",
"license": "MIT",
"homepage": "https://github.com/storybooks/marksy",
"bugs": {
"url": "https://github.com/cerebral/marksy/issues"
"url": "https://github.com/storybooks/marksy/issues"
},
"homepage": "https://github.com/cerebral/marksy",
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-jest": "^19.0.0",
"babel-loader": "^7.0.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"css-loader": "^0.15.2",
"highlight.js": "^9.12.0",
"inferno-create-element": "^3.3.1",
"inferno-server": "^3.3.1",
"jest": "^20.0.1",
"json-loader": "^0.5.2",
"node-libs-browser": "^0.5.2",
"preact": "^8.1.0",
"preact-render-to-string": "^3.6.3",
"prismjs": "^1.6.0",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react-test-renderer": "^15.5.4",
"regenerator-runtime": "^0.10.3",
"size-limit": "^0.13.1",
"style-loader": "^0.12.3",
"webpack": "^2.4.1",
"webpack-dev-server": "^2.4.2"
"license": "MIT",
"author": "Christian Alfoni",
"main": "lib/index.js",
"repository": {
"type": "git",
"url": "https://github.com/storybooks/marksy"
},
"scripts": {
"build": "BABEL_ENV=production babel src/ --out-dir=lib/ -s",
"lint": "cross-env NODE_ENV=production eslint --cache --cache-location=.cache/eslint --ext .js,.jsx,.json ./src ./app",
"prepare": "npm run build",
"size": "size-limit",
"start": "webpack-dev-server --devtool eval-source-map --progress --colors --content-base build",
"test": "jest && size-limit"
},
"dependencies": {
"babel-standalone": "^6.24.0",
"babel-standalone": "^6.26.0",
"he": "^1.1.1",
"marked": "^0.3.9"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.1.2",
"babel-jest": "^22.0.4",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"cross-env": "^5.1.3",
"css-loader": "^0.28.7",
"eslint": "^4.14.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jest": "^21.5.0",
"eslint-plugin-json": "^1.2.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-prettier": "^2.4.0",
"eslint-plugin-react": "^7.5.1",
"global": "^4.3.2",
"highlight.js": "^9.12.0",
"inferno-create-element": "^3.10.1",
"inferno-server": "^3.10.1",
"jest": "^22.0.4",
"json-loader": "^0.5.7",
"node-libs-browser": "^2.1.0",
"preact": "^8.2.7",
"preact-render-to-string": "^3.7.0",
"prettier": "^1.9.2",
"prismjs": "^1.9.0",
"prop-types": "^15.6.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-test-renderer": "^16.2.0",
"regenerator-runtime": "^0.11.1",
"size-limit": "^0.13.2",
"style-loader": "^0.19.1",
"webpack": "^3.10.0",
"webpack-dev-server": "^2.9.7"
},
"size-limit": [
{
"path": "lib/index.js",
"limit": "31 KB"
"limit": "30 KB"
}
]
}

@@ -1,9 +0,11 @@

# marksy
# Marksy
A markdown to custom components library. Supports any virtual DOM library.
## Install
## Installation
`npm install marksy`
```sh
npm install marksy
```
## API
## Usage
```js

@@ -46,9 +48,9 @@ import React, {createElement} from 'React';

code ({language, code}) {},
codespan ({children}) {}
}
})
codespan ({children}) {},
},
});
const compiled = compile('# hello', {
// Options passed to "marked" (https://www.npmjs.com/package/marked)
})
});

@@ -90,3 +92,3 @@ compiled.tree // The React tree of components

## Context
### Context
You might need to pass in general information to your custom elements and components. You can pass in a context to do so:

@@ -117,3 +119,3 @@

## Code highlighting
### Code highlighting
To enable code highlighting you just need to add a method that does the transformation. Here is an example with [Highlight.js](https://highlightjs.org/), but you could also use [Prism](http://prismjs.com/). Both of them support server side rendering. For example:

@@ -120,0 +122,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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