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

terra-markdown

Package Overview
Dependencies
Maintainers
10
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terra-markdown - npm Package Compare versions

Comparing version 2.26.0 to 2.27.0

8

CHANGELOG.md

@@ -7,2 +7,10 @@ Changelog

2.27.0 - (June 11, 2019)
------------------
### Removed
* Removed node_modules from .npmignore
### Changed
* Made required updates to consume terra-toolkit v5 and terra-dev-site v5
2.26.0 - (May 1, 2019)

@@ -9,0 +17,0 @@ ------------------

78

lib/Markdown.js

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

'use strict';
"use strict";

@@ -6,48 +6,38 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = _interopRequireDefault(require("react"));
var _react = require('react');
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react2 = _interopRequireDefault(_react);
var _bind = _interopRequireDefault(require("classnames/bind"));
var _propTypes = require('prop-types');
var _marked = _interopRequireDefault(require("marked"));
var _propTypes2 = _interopRequireDefault(_propTypes);
var _prismjs = _interopRequireDefault(require("prismjs"));
var _bind = require('classnames/bind');
require("prismjs/components/prism-diff");
var _bind2 = _interopRequireDefault(_bind);
require("prismjs/components/prism-jsx");
var _marked = require('marked');
require("prismjs/components/prism-scss");
var _marked2 = _interopRequireDefault(_marked);
var _Markdown = _interopRequireDefault(require("./Markdown.scss"));
var _prismjs = require('prismjs');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _prismjs2 = _interopRequireDefault(_prismjs);
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
require('prismjs/components/prism-diff');
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
require('prismjs/components/prism-jsx');
var cx = _bind.default.bind(_Markdown.default); // Create a list of loaded languages, remove functions that aren't actaully languages.
require('prismjs/components/prism-scss');
var _Markdown = require('./Markdown.scss');
var _Markdown2 = _interopRequireDefault(_Markdown);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var cx = _bind2.default.bind(_Markdown2.default);
// Create a list of loaded languages, remove functions that aren't actaully languages.
var supportedLanguages = Object.keys(_prismjs2.default.languages).filter(function (lang) {
var supportedLanguages = Object.keys(_prismjs.default.languages).filter(function (lang) {
return !['extend', 'insertBefore', 'DFS'].includes(lang);
});
}); // If the supported language is requested, highlight it.
// If the supported language is requested, highlight it.
var highlight = function highlight(code, lang) {
if (supportedLanguages.includes(lang)) {
return _prismjs2.default.highlight(code, _prismjs2.default.languages[lang], lang);
return _prismjs.default.highlight(code, _prismjs.default.languages[lang], lang);
}

@@ -58,3 +48,3 @@

_marked2.default.setOptions({
_marked.default.setOptions({
headerIds: false,

@@ -65,8 +55,7 @@ highlight: highlight,

var renderer = new _marked2.default.Renderer();
var renderer = new _marked.default.Renderer(); // Override how heading renders to add the anchor.
// Override how heading renders to add the anchor.
renderer.heading = function (text, level) {
var escapedText = text.toLowerCase().replace(/[^\w]+/g, '-');
return '<h' + level + '>' + ('<a name="' + escapedText + '" class="anchor" aria-hidden="true" href="#' + escapedText + '">') + '<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="is-bidi octicon octicon-link"><path d="M10.5 26.3a16 16 0 0 1 .9-5.3L8 17.6a6.73 6.73 0 0 1-2-4.8A6.41 6.41 0 0 1 8 8a6.76 6.76 0 0 1 9.6 0l9 9a6.88 6.88 0 0 1 0 9.6 6.27 6.27 0 0 1-3.4 1.8 2.65 2.65 0 0 0 .5.6l4.1 4.1a11.36 11.36 0 0 0 3.1-2.3 12.8 12.8 0 0 0 0-18.1l-9-9a12.63 12.63 0 0 0-9-3.7 12.63 12.63 0 0 0-9 3.7A12.1 12.1 0 0 0 0 12.8a12.63 12.63 0 0 0 3.7 9l7 7a21.05 21.05 0 0 1-.2-2.5zm27-4.6a16 16 0 0 1-.9 5.3l3.4 3.4a6.79 6.79 0 1 1-9.6 9.6l-9-9a6.88 6.88 0 0 1 0-9.6 6.27 6.27 0 0 1 3.4-1.8 2.65 2.65 0 0 0-.5-.6l-4-4a11.36 11.36 0 0 0-3.1 2.3 12.8 12.8 0 0 0 0 18.1l9 9a12.73 12.73 0 0 0 18-18l-7-7a8 8 0 0 1 .3 2.3z"/></svg>' + '</a>' + ('' + text) + ('</h' + level + '>');
return "<h".concat(level, ">") + "<a name=\"".concat(escapedText, "\" class=\"anchor\" aria-hidden=\"true\" href=\"#").concat(escapedText, "\">") + '<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="is-bidi octicon octicon-link"><path d="M10.5 26.3a16 16 0 0 1 .9-5.3L8 17.6a6.73 6.73 0 0 1-2-4.8A6.41 6.41 0 0 1 8 8a6.76 6.76 0 0 1 9.6 0l9 9a6.88 6.88 0 0 1 0 9.6 6.27 6.27 0 0 1-3.4 1.8 2.65 2.65 0 0 0 .5.6l4.1 4.1a11.36 11.36 0 0 0 3.1-2.3 12.8 12.8 0 0 0 0-18.1l-9-9a12.63 12.63 0 0 0-9-3.7 12.63 12.63 0 0 0-9 3.7A12.1 12.1 0 0 0 0 12.8a12.63 12.63 0 0 0 3.7 9l7 7a21.05 21.05 0 0 1-.2-2.5zm27-4.6a16 16 0 0 1-.9 5.3l3.4 3.4a6.79 6.79 0 1 1-9.6 9.6l-9-9a6.88 6.88 0 0 1 0-9.6 6.27 6.27 0 0 1 3.4-1.8 2.65 2.65 0 0 0-.5-.6l-4-4a11.36 11.36 0 0 0-3.1 2.3 12.8 12.8 0 0 0 0 18.1l9 9a12.73 12.73 0 0 0 18-18l-7-7a8 8 0 0 1 .3 2.3z"/></svg>' + '</a>' + "".concat(text) + "</h".concat(level, ">");
};

@@ -78,24 +67,29 @@

*/
src: _propTypes2.default.string,
src: _propTypes.default.string,
/**
* A prefix url for any relative link.
*/
baseUrl: _propTypes2.default.string,
baseUrl: _propTypes.default.string,
/**
* Enable anchors for heading elements.
*/
hasHeadingAnchors: _propTypes2.default.bool
hasHeadingAnchors: _propTypes.default.bool
};
var defaultProps = {
src: ''
};
/* eslint react/no-danger:0 */
/* eslint react/no-danger:0 */
var Markdown = function Markdown(props) {
return _react2.default.createElement('div', {
dir: 'ltr',
return _react.default.createElement("div", {
dir: "ltr",
className: cx(['markdown']),
dangerouslySetInnerHTML: {
__html: (0, _marked2.default)(props.src, _extends({}, props.baseUrl && { baseUrl: props.baseUrl }, props.hasHeadingAnchors && { renderer: renderer }))
__html: (0, _marked.default)(props.src, _objectSpread({}, props.baseUrl && {
baseUrl: props.baseUrl
}, props.hasHeadingAnchors && {
renderer: renderer
}))
}

@@ -107,3 +101,3 @@ });

Markdown.defaultProps = defaultProps;
exports.default = Markdown;
var _default = Markdown;
exports.default = _default;

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

'use strict';
"use strict";

@@ -6,20 +6,14 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _Markdown = _interopRequireDefault(require("terra-markdown/lib/Markdown"));
var _Markdown = require('terra-markdown/lib/Markdown');
var _README = _interopRequireDefault(require("../../../../docs/README.md"));
var _Markdown2 = _interopRequireDefault(_Markdown);
var _README = require('../../../../docs/README.md');
var _README2 = _interopRequireDefault(_README);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// eslint-disable-next-line import/no-extraneous-dependencies, import/no-unresolved, import/extensions
// We're not using the doc template here to avoid circular dependencies.
// eslint-disable-next-line import/no-extraneous-dependencies, import/no-unresolved, import/extensions
var style = {

@@ -33,9 +27,10 @@ height: '100%',

var MarkdownExample = function MarkdownExample() {
return _react2.default.createElement(
'div',
{ style: style },
_react2.default.createElement(_Markdown2.default, { src: _README2.default })
);
return _react.default.createElement("div", {
style: style
}, _react.default.createElement(_Markdown.default, {
src: _README.default
}));
};
exports.default = MarkdownExample;
var _default = MarkdownExample;
exports.default = _default;

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

'use strict';
"use strict";

@@ -6,21 +6,19 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _Markdown = _interopRequireDefault(require("../../../../lib/Markdown"));
var _Markdown = require('../../../../lib/Markdown');
var _blockquote = _interopRequireDefault(require("./blockquote.md"));
var _Markdown2 = _interopRequireDefault(_Markdown);
var _blockquote = require('./blockquote.md');
var _blockquote2 = _interopRequireDefault(_blockquote);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var MarkdownTest = function MarkdownTest() {
return _react2.default.createElement(_Markdown2.default, { src: _blockquote2.default });
return _react.default.createElement(_Markdown.default, {
src: _blockquote.default
});
};
exports.default = MarkdownTest;
var _default = MarkdownTest;
exports.default = _default;

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

'use strict';
"use strict";

@@ -6,21 +6,19 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _Markdown = _interopRequireDefault(require("../../../../lib/Markdown"));
var _Markdown = require('../../../../lib/Markdown');
var _css = _interopRequireDefault(require("./css.md"));
var _Markdown2 = _interopRequireDefault(_Markdown);
var _css = require('./css.md');
var _css2 = _interopRequireDefault(_css);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var CssTest = function CssTest() {
return _react2.default.createElement(_Markdown2.default, { src: _css2.default });
return _react.default.createElement(_Markdown.default, {
src: _css.default
});
};
exports.default = CssTest;
var _default = CssTest;
exports.default = _default;

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

'use strict';
"use strict";

@@ -6,21 +6,19 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _Markdown = _interopRequireDefault(require("../../../../lib/Markdown"));
var _Markdown = require('../../../../lib/Markdown');
var _diff = _interopRequireDefault(require("./diff.md"));
var _Markdown2 = _interopRequireDefault(_Markdown);
var _diff = require('./diff.md');
var _diff2 = _interopRequireDefault(_diff);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var DiffTest = function DiffTest() {
return _react2.default.createElement(_Markdown2.default, { src: _diff2.default });
return _react.default.createElement(_Markdown.default, {
src: _diff.default
});
};
exports.default = DiffTest;
var _default = DiffTest;
exports.default = _default;

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

'use strict';
"use strict";

@@ -6,21 +6,19 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _Markdown = _interopRequireDefault(require("../../../../lib/Markdown"));
var _Markdown = require('../../../../lib/Markdown');
var _html = _interopRequireDefault(require("./html.md"));
var _Markdown2 = _interopRequireDefault(_Markdown);
var _html = require('./html.md');
var _html2 = _interopRequireDefault(_html);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var HtmlTest = function HtmlTest() {
return _react2.default.createElement(_Markdown2.default, { src: _html2.default });
return _react.default.createElement(_Markdown.default, {
src: _html.default
});
};
exports.default = HtmlTest;
var _default = HtmlTest;
exports.default = _default;

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

'use strict';
"use strict";

@@ -6,21 +6,19 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _Markdown = _interopRequireDefault(require("../../../../lib/Markdown"));
var _Markdown = require('../../../../lib/Markdown');
var _javascript = _interopRequireDefault(require("./javascript.md"));
var _Markdown2 = _interopRequireDefault(_Markdown);
var _javascript = require('./javascript.md');
var _javascript2 = _interopRequireDefault(_javascript);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var JavascriptTest = function JavascriptTest() {
return _react2.default.createElement(_Markdown2.default, { src: _javascript2.default });
return _react.default.createElement(_Markdown.default, {
src: _javascript.default
});
};
exports.default = JavascriptTest;
var _default = JavascriptTest;
exports.default = _default;

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

'use strict';
"use strict";

@@ -6,21 +6,19 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _Markdown = _interopRequireDefault(require("../../../../lib/Markdown"));
var _Markdown = require('../../../../lib/Markdown');
var _jsx = _interopRequireDefault(require("./jsx.md"));
var _Markdown2 = _interopRequireDefault(_Markdown);
var _jsx = require('./jsx.md');
var _jsx2 = _interopRequireDefault(_jsx);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var JsxTest = function JsxTest() {
return _react2.default.createElement(_Markdown2.default, { src: _jsx2.default });
return _react.default.createElement(_Markdown.default, {
src: _jsx.default
});
};
exports.default = JsxTest;
var _default = JsxTest;
exports.default = _default;

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

'use strict';
"use strict";

@@ -6,21 +6,19 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _Markdown = _interopRequireDefault(require("../../../../lib/Markdown"));
var _Markdown = require('../../../../lib/Markdown');
var _Markdown2 = _interopRequireDefault(require("./Markdown.md"));
var _Markdown2 = _interopRequireDefault(_Markdown);
var _Markdown3 = require('./Markdown.md');
var _Markdown4 = _interopRequireDefault(_Markdown3);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var MarkdownTest = function MarkdownTest() {
return _react2.default.createElement(_Markdown2.default, { src: _Markdown4.default });
return _react.default.createElement(_Markdown.default, {
src: _Markdown2.default
});
};
exports.default = MarkdownTest;
var _default = MarkdownTest;
exports.default = _default;

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

'use strict';
"use strict";

@@ -6,21 +6,19 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _Markdown = _interopRequireDefault(require("../../../../lib/Markdown"));
var _Markdown = require('../../../../lib/Markdown');
var _noformat = _interopRequireDefault(require("./noformat.md"));
var _Markdown2 = _interopRequireDefault(_Markdown);
var _noformat = require('./noformat.md');
var _noformat2 = _interopRequireDefault(_noformat);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var NoformatTest = function NoformatTest() {
return _react2.default.createElement(_Markdown2.default, { src: _noformat2.default });
return _react.default.createElement(_Markdown.default, {
src: _noformat.default
});
};
exports.default = NoformatTest;
var _default = NoformatTest;
exports.default = _default;

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

'use strict';
"use strict";

@@ -6,21 +6,19 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _Markdown = _interopRequireDefault(require("../../../../lib/Markdown"));
var _Markdown = require('../../../../lib/Markdown');
var _scss = _interopRequireDefault(require("./scss.md"));
var _Markdown2 = _interopRequireDefault(_Markdown);
var _scss = require('./scss.md');
var _scss2 = _interopRequireDefault(_scss);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var ScssTest = function ScssTest() {
return _react2.default.createElement(_Markdown2.default, { src: _scss2.default });
return _react.default.createElement(_Markdown.default, {
src: _scss.default
});
};
exports.default = ScssTest;
var _default = ScssTest;
exports.default = _default;
{
"name": "terra-markdown",
"main": "lib/Markdown.js",
"version": "2.26.0",
"version": "2.27.0",
"description": "React component to display the content of markdown files.",

@@ -34,8 +34,7 @@ "repository": {

"scripts": {
"compile": "npm run compile:clean && npm run compile:build",
"compile:clean": "rm -rf lib",
"compile:build": "babel src --out-dir lib --copy-files",
"compile": "babel --root-mode upward src --out-dir lib --copy-files",
"lint": "npm run lint:js && npm run lint:scss",
"lint:js": "eslint --ext .js,.jsx . --ignore-path ../../.eslintignore",
"lint:scss": "stylelint src/**/*.scss",
"precompile": "rm -rf lib",
"test": "npm run test:jest && npm run test:wdio",

@@ -42,0 +41,0 @@ "test:jest": "jest --config ../../jestconfig.js",

@@ -5,3 +5,3 @@ # Terra Markdown

[![NPM version](https://badgen.net/npm/v/terra-markdown)](https://www.npmjs.org/package/terra-markdown)
[![Build Status](https://badgen.net/travis/cerner/terra-core)](https://travis-ci.org/cerner/terra-core)
[![Build Status](https://badgen.net/travis/cerner/terra-core)](https://travis-ci.com/cerner/terra-core)

@@ -8,0 +8,0 @@ React component to display the content of markdown files.

@@ -6,3 +6,3 @@ describe('Markdown', () => {

Terra.should.validateElement({ selector: '#root' });
Terra.it.validatesElement({ selector: '#root' });
});

@@ -13,3 +13,3 @@

Terra.should.validateElement();
Terra.it.validatesElement();
});

@@ -20,3 +20,3 @@

Terra.should.validateElement();
Terra.it.validatesElement();
});

@@ -27,3 +27,3 @@

Terra.should.validateElement();
Terra.it.validatesElement();
});

@@ -34,3 +34,3 @@

Terra.should.validateElement();
Terra.it.validatesElement();
});

@@ -41,3 +41,3 @@

Terra.should.validateElement();
Terra.it.validatesElement();
});

@@ -48,3 +48,3 @@

Terra.should.validateElement();
Terra.it.validatesElement();
});

@@ -55,3 +55,3 @@

Terra.should.validateElement();
Terra.it.validatesElement();
});

@@ -62,10 +62,4 @@

Terra.should.validateElement();
Terra.should.themeCombinationOfCustomProperties({
testName: 'themed',
properties: {
'--terra-markdown-blockquote-color': 'red',
},
});
Terra.it.validatesElement();
});
});
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