abstract-document
Advanced tools
Comparing version 2.2.5 to 2.2.6
import { SectionElement } from "../section-elements/section-element"; | ||
export interface MarkdownProps { | ||
readonly text: string; | ||
readonly keepTogetherSections?: boolean; | ||
} | ||
export declare function create({text}: MarkdownProps): Array<SectionElement>; | ||
export declare function create({text, keepTogetherSections}: MarkdownProps): Array<SectionElement>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var markdown_to_ast_1 = require("markdown-to-ast"); | ||
var markdown_to_ast_1 = require("@textlint/markdown-to-ast"); | ||
var Paragraph = require("../section-elements/paragraph"); | ||
var Group = require("../section-elements/group"); | ||
function preProcessMarkdownAst(ast, styles, atoms, paragraphs, d) { | ||
@@ -53,7 +54,25 @@ if (ast.type === "Str") { | ||
function create(_a) { | ||
var text = _a.text; | ||
var text = _a.text, keepTogetherSections = _a.keepTogetherSections; | ||
var ast = markdown_to_ast_1.parse(text); | ||
return preProcessMarkdownAst(ast, [], [], [], 0).paragraphs; | ||
var paragraphs = preProcessMarkdownAst(ast, [], [], [], 0).paragraphs; | ||
if (keepTogetherSections !== true) { | ||
return paragraphs; | ||
} | ||
else { | ||
var groups_1 = [[]]; | ||
paragraphs.forEach(function (p) { | ||
var group = groups_1[groups_1.length - 1]; | ||
if (group.length !== 0 && p.styleName.startsWith("H")) { | ||
groups_1.push([p]); | ||
} | ||
else { | ||
group.push(p); | ||
} | ||
}); | ||
return groups_1.map(function (group) { | ||
return Group.create({ children: group, keepTogether: true }); | ||
}); | ||
} | ||
} | ||
exports.create = create; | ||
//# sourceMappingURL=markdown.js.map |
import { SectionElement } from "../section-elements/section-element"; | ||
export interface MarkdownProps { | ||
readonly text: string; | ||
readonly keepTogetherSections?: boolean; | ||
} | ||
export declare function create({text}: MarkdownProps): Array<SectionElement>; | ||
export declare function create({text, keepTogetherSections}: MarkdownProps): Array<SectionElement>; |
@@ -1,3 +0,4 @@ | ||
import { parse } from "markdown-to-ast"; | ||
import { parse } from "@textlint/markdown-to-ast"; | ||
import * as Paragraph from "../section-elements/paragraph"; | ||
import * as Group from "../section-elements/group"; | ||
function preProcessMarkdownAst(ast, styles, atoms, paragraphs, d) { | ||
@@ -51,6 +52,24 @@ if (ast.type === "Str") { | ||
export function create(_a) { | ||
var text = _a.text; | ||
var text = _a.text, keepTogetherSections = _a.keepTogetherSections; | ||
var ast = parse(text); | ||
return preProcessMarkdownAst(ast, [], [], [], 0).paragraphs; | ||
var paragraphs = preProcessMarkdownAst(ast, [], [], [], 0).paragraphs; | ||
if (keepTogetherSections !== true) { | ||
return paragraphs; | ||
} | ||
else { | ||
var groups_1 = [[]]; | ||
paragraphs.forEach(function (p) { | ||
var group = groups_1[groups_1.length - 1]; | ||
if (group.length !== 0 && p.styleName.startsWith("H")) { | ||
groups_1.push([p]); | ||
} | ||
else { | ||
group.push(p); | ||
} | ||
}); | ||
return groups_1.map(function (group) { | ||
return Group.create({ children: group, keepTogether: true }); | ||
}); | ||
} | ||
} | ||
//# sourceMappingURL=markdown.js.map |
{ | ||
"name": "abstract-document", | ||
"version": "2.2.5", | ||
"version": "2.2.6", | ||
"description": "Dynamically create documents using code or JSX and render to any format", | ||
@@ -11,6 +11,6 @@ "repository": "https://github.com/dividab/abstract-visuals/tree/master/packages/abstract-document", | ||
"dependencies": { | ||
"@textlint/markdown-to-ast": "^6.0.3", | ||
"abstract-image": "^2.2.5", | ||
"base64-js": "^1.2.0", | ||
"blob-stream": "^0.1.3", | ||
"markdown-to-ast": "^6.0.3", | ||
"pdfkit": "^0.8.0", | ||
@@ -17,0 +17,0 @@ "ramda": "^0.22.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
556823
8184
1
+ Added@textlint/markdown-to-ast@6.3.5(transitive)
+ Addeddebug@4.3.5(transitive)
+ Addedfault@1.0.4(transitive)
+ Addedformat@0.2.2(transitive)
+ Addedms@2.1.2(transitive)
+ Addedremark-frontmatter@1.3.3(transitive)
+ Addedremark-parse@5.0.0(transitive)
- Removedmarkdown-to-ast@^6.0.3
- Removedccount@1.1.0(transitive)
- Removedcharacter-entities-html4@1.1.4(transitive)
- Removeddebug@2.6.9(transitive)
- Removedis-alphanumeric@1.0.0(transitive)
- Removedlongest-streak@2.0.4(transitive)
- Removedmarkdown-table@1.1.3(transitive)
- Removedmarkdown-to-ast@6.0.3(transitive)
- Removedmdast-util-compact@1.0.4(transitive)
- Removedms@2.0.0(transitive)
- Removedremark@7.0.1(transitive)
- Removedremark-parse@3.0.1(transitive)
- Removedremark-stringify@3.0.1(transitive)
- Removedstringify-entities@1.3.2(transitive)