@ndla/util
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -12,2 +12,3 @@ /** | ||
export var parseMarkdown = function parseMarkdown(embeddedCaption) { | ||
var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'caption'; | ||
var markdown = new Remarkable({ | ||
@@ -18,2 +19,12 @@ breaks: true, | ||
markdown.inline.ruler.enable(['sub', 'sup']); | ||
if (parser === 'caption') { | ||
markdown.set({ | ||
html: false, | ||
breaks: false | ||
}); | ||
markdown.block.ruler.disable(['table', 'footnote', 'blockquote', 'code', 'fences', 'footnote', 'heading', 'hr', 'htmlblock', 'lheading', 'list', 'table']); | ||
markdown.inline.ruler.disable(['autolink', 'backticks', 'del', 'entity', 'escape', 'footnote_ref', 'htmltag', 'links', 'newline', 'text']); | ||
} | ||
var caption = embeddedCaption || ''; | ||
@@ -20,0 +31,0 @@ /** |
@@ -8,2 +8,3 @@ /** | ||
*/ | ||
export declare const parseMarkdown: (embeddedCaption: string) => JSX.Element; | ||
export declare type ParseType = 'caption' | 'body'; | ||
export declare const parseMarkdown: (embeddedCaption: string, parser?: ParseType) => JSX.Element; |
@@ -23,2 +23,3 @@ "use strict"; | ||
var parseMarkdown = function parseMarkdown(embeddedCaption) { | ||
var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'caption'; | ||
var markdown = new _remarkable.Remarkable({ | ||
@@ -29,2 +30,12 @@ breaks: true, | ||
markdown.inline.ruler.enable(['sub', 'sup']); | ||
if (parser === 'caption') { | ||
markdown.set({ | ||
html: false, | ||
breaks: false | ||
}); | ||
markdown.block.ruler.disable(['table', 'footnote', 'blockquote', 'code', 'fences', 'footnote', 'heading', 'hr', 'htmlblock', 'lheading', 'list', 'table']); | ||
markdown.inline.ruler.disable(['autolink', 'backticks', 'del', 'entity', 'escape', 'footnote_ref', 'htmltag', 'links', 'newline', 'text']); | ||
} | ||
var caption = embeddedCaption || ''; | ||
@@ -31,0 +42,0 @@ /** |
{ | ||
"name": "@ndla/util", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Collection of util functions used by NDLA", | ||
@@ -36,3 +36,3 @@ "license": "GPL-3.0", | ||
}, | ||
"gitHead": "1682299abb08592d13280c3447db580de9b52808" | ||
"gitHead": "e10a8348999df08fd71cc4959e873252395bfea9" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
72670
935
0