Socket
Socket
Sign inDemoInstall

abstract-document

Package Overview
Dependencies
207
Maintainers
10
Versions
135
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.5 to 2.2.6

3

lib-cjs/abstract-document/markdown/markdown.d.ts
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc