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

@polymer/marked-element

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polymer/marked-element - npm Package Compare versions

Comparing version 3.0.0-pre.12 to 3.0.0-pre.13

136

marked-element.js

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

import '@polymer/polymer/polymer-legacy.js';
import './marked-import.js';
import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js';
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js';
/**

@@ -95,2 +89,14 @@ @license

*/
/*
FIXME(polymer-modulizer): the above comments were extracted
from HTML and may be out of place here. Review them and
then delete this comment!
*/
import '../polymer/polymer-legacy.js';
import './marked-import.js';
import { Polymer } from '../polymer/lib/legacy/polymer-fn.js';
import { html } from '../polymer/lib/utils/html-tag.js';
import { dom } from '../polymer/lib/legacy/polymer.dom.js';
Polymer({

@@ -115,36 +121,25 @@ _template: html`

*/
markdown: {
type: String,
value: null
},
markdown: {type: String, value: null},
/**
* Enable GFM line breaks (regular newlines instead of two spaces for breaks)
* Enable GFM line breaks (regular newlines instead of two spaces for
* breaks)
*/
breaks: {
type: Boolean,
value: false
},
breaks: {type: Boolean, value: false},
/**
* Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
* Conform to obscure parts of markdown.pl as much as possible. Don't fix
* any of the original markdown bugs or poor behavior.
*/
pedantic: {
type: Boolean,
value: false
},
pedantic: {type: Boolean, value: false},
/**
* Function used to customize a renderer based on the [API specified in the Marked
* Function used to customize a renderer based on the [API specified in the
* Marked
* library](https://github.com/chjj/marked#overriding-renderer-methods).
* It takes one argument: a marked renderer object, which is mutated by the function.
* It takes one argument: a marked renderer object, which is mutated by the
* function.
*/
renderer: {
type: Function,
value: null
},
renderer: {type: Function, value: null},
/**
* Sanitize the output. Ignore any HTML that has been input.
*/
sanitize: {
type: Boolean,
value: false
},
sanitize: {type: Boolean, value: false},
/**

@@ -156,8 +151,6 @@ * Function used to customize a sanitize behavior.

* Note: To enable this function, must set `sanitize` to true.
* WARNING: If you are using this option to untrusted text, you must to prevent XSS Attacks.
* WARNING: If you are using this option to untrusted text, you must to
* prevent XSS Attacks.
*/
sanitizer: {
type: Function,
value: null
},
sanitizer: {type: Function, value: null},
/**

@@ -170,21 +163,13 @@ * If true, disables the default sanitization of any markdown received by

*/
disableRemoteSanitization: {
type: Boolean,
value: false
},
disableRemoteSanitization: {type: Boolean, value: false},
/**
* Use "smart" typographic punctuation for things like quotes and dashes.
*/
smartypants: {
type: Boolean,
value: false
},
smartypants: {type: Boolean, value: false},
/**
* Callback function invoked by Marked after HTML has been rendered.
* It must take two arguments: err and text and must return the resulting text.
* It must take two arguments: err and text and must return the resulting
* text.
*/
callback: {
type: Function,
value: null
},
callback: {type: Function, value: null},
/**

@@ -196,7 +181,3 @@ * A reference to the XMLHttpRequest instance used to generate the

*/
xhr: {
type: Object,
notify: true,
readOnly: true
}
xhr: {type: Object, notify: true, readOnly: true}
},

@@ -213,5 +194,7 @@

// Use the Markdown from the first `<script>` descendant whose MIME type starts with
// "text/markdown". Script elements beyond the first are ignored.
this._markdownElement = dom(this).querySelector('[type="text/markdown"]');
// Use the Markdown from the first `<script>` descendant whose MIME type
// starts with "text/markdown". Script elements beyond the first are
// ignored.
this._markdownElement =
dom(this).querySelector('[type="text/markdown"]');
if (!this._markdownElement) {

@@ -229,5 +212,5 @@ return;

var observer = new MutationObserver(this._onScriptAttributeChanged
.bind(this));
observer.observe(this._markdownElement, { attributes: true });
var observer =
new MutationObserver(this._onScriptAttributeChanged.bind(this));
observer.observe(this._markdownElement, {attributes: true});
},

@@ -267,4 +250,5 @@

get outputElement () {
var child = dom(this).queryDistributedElements('[slot="markdown-html"]')[0];
get outputElement() {
var child =
dom(this).queryDistributedElements('[slot="markdown-html"]')[0];
return child || this.$.content;

@@ -316,3 +300,4 @@ },

dom(this._outputElement).innerHTML = marked(this.markdown, opts, this.callback);
dom(this._outputElement).innerHTML =
marked(this.markdown, opts, this.callback);
this.fire('marked-render-complete', {}, {composed: true});

@@ -323,5 +308,6 @@ },

* Fired when the content is being processed and before it is rendered.
* Provides an opportunity to highlight code blocks based on the programming language used. This
* is also known as syntax highlighting. One example would be to use a prebuilt syntax
* highlighting library, e.g with [highlightjs](https://highlightjs.org/).
* Provides an opportunity to highlight code blocks based on the programming
* language used. This is also known as syntax highlighting. One example would
* be to use a prebuilt syntax highlighting library, e.g with
* [highlightjs](https://highlightjs.org/).
*

@@ -334,3 +320,4 @@ * @param {string} code

_highlight: function(code, lang) {
var event = this.fire('syntax-highlight', {code: code, lang: lang}, {composed: true});
var event = this.fire(
'syntax-highlight', {code: code, lang: lang}, {composed: true});
return event.detail.code || code;

@@ -344,13 +331,20 @@ },

_unindent: function(text) {
if (!text) return text;
var lines = text.replace(/\t/g, ' ').split('\n');
if (!text)
return text;
var lines = text.replace(/\t/g, ' ').split('\n');
var indent = lines.reduce(function(prev, line) {
if (/^\s*$/.test(line)) return prev; // Completely ignore blank lines.
if (/^\s*$/.test(line))
return prev; // Completely ignore blank lines.
var lineIndent = line.match(/^(\s*)/)[0].length;
if (prev === null) return lineIndent;
if (prev === null)
return lineIndent;
return lineIndent < prev ? lineIndent : prev;
}, null);
return lines.map(function(l) { return l.substr(indent); }).join('\n');
return lines
.map(function(l) {
return l.substr(indent);
})
.join('\n');
},

@@ -357,0 +351,0 @@

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

import 'marked/lib/marked.js';
/**

@@ -11,6 +10,9 @@ @license

*/
import '../../marked/lib/marked.js';
if (!window.marked) {
// For webpack support for the Polymer 3 version created by the Polymer Modulizer
// More info: https://github.com/PolymerElements/marked-element/issues/81
// For webpack support for the Polymer 3 version created by the Polymer
// Modulizer More info:
// https://github.com/PolymerElements/marked-element/issues/81
window.marked = require('../../marked/lib/marked.js');
}

@@ -20,12 +20,14 @@ {

"bower": "^1.8.0",
"@polymer/paper-styles": "3.0.0-pre.12",
"@polymer/iron-component-page": "3.0.0-pre.12",
"@polymer/test-fixture": "3.0.0-pre.12",
"wct-browser-legacy": "0.0.1-pre.11",
"@webcomponents/webcomponentsjs": "^1.0.0"
"webmat": "^0.2.0",
"@polymer/paper-styles": "^3.0.0-pre.13",
"@polymer/iron-component-page": "^3.0.0-pre.13",
"@polymer/test-fixture": "^3.0.0-pre.13",
"wct-browser-legacy": "^0.0.1-pre.11",
"@webcomponents/webcomponentsjs": "^2.0.0-0"
},
"scripts": {
"update-types": "bower install && gen-typescript-declarations --deleteExisting --outDir ."
"update-types": "bower install && gen-typescript-declarations --deleteExisting --outDir .",
"format": "webmat && npm run update-types"
},
"version": "3.0.0-pre.12",
"version": "3.0.0-pre.13",
"resolutions": {

@@ -41,4 +43,4 @@ "inherits": "2.0.3",

"marked": "~0.3.9",
"@polymer/polymer": "3.0.0-pre.12"
"@polymer/polymer": "^3.0.0-pre.13"
}
}

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