rapier-markdown-kit 1.2.16 → 1.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,6 +5,8 @@ export interface DocumentParts { ledger?: LedgerEnvelope | null; authorship?: Au
|
|
|
5
5
|
export interface ReadParts { text: string; ledger: LedgerEnvelope | null; authorship: AuthorshipEnvelope | null; }
|
|
6
6
|
/** The text with its parts appended as one EOF comment; the text alone when there are none. */
|
|
7
7
|
export function writeDocument(text: string, parts?: DocumentParts): string;
|
|
8
|
+
/** The verified EOF comment without copying the source; empty when there are no carried parts. */
|
|
9
|
+
export function documentTrailer(text: string, parts?: DocumentParts): string;
|
|
8
10
|
/** Splits a saved file into its exact text and verified parts; throws on a damaged or mismatched comment. */
|
|
9
11
|
export function readDocument(source: string): ReadParts;
|
|
10
12
|
export function writeParts(text: string, parts?: DocumentParts): string;
|
|
@@ -47,11 +47,14 @@ export function takeParts(html, text) {
|
|
|
47
47
|
return {html: stripped, ...readParts(text ?? '', elements)};
|
|
48
48
|
}
|
|
49
49
|
const OPEN = '\n\n<!-- rapier-carried/1\n', CLOSE = '\n-->\n';
|
|
50
|
-
export function
|
|
50
|
+
export function documentTrailer(text, options) {
|
|
51
51
|
const parts = validateParts(text, options);
|
|
52
|
-
if (!parts.ledger && !parts.authorship) return
|
|
52
|
+
if (!parts.ledger && !parts.authorship) return '';
|
|
53
53
|
const json = JSON.stringify(parts).replace(/</g, '\\u003c').replace(/>/g, '\\u003e');
|
|
54
|
-
return
|
|
54
|
+
return OPEN + json + CLOSE;
|
|
55
|
+
}
|
|
56
|
+
export function writeDocument(text, options) {
|
|
57
|
+
return text + documentTrailer(text, options);
|
|
55
58
|
}
|
|
56
59
|
export function readDocument(source) {
|
|
57
60
|
if (!source.endsWith(CLOSE)) {
|
|
@@ -10,8 +10,8 @@ export {_rapierTransformSplices, _rapierRecordSplices, _rapierValidLedgerRecord,
|
|
|
10
10
|
import {replayHistory, sourceBefore, historyProjection, historyProjections, historyPlaces, selectiveUndo, groupHistoryActs, pictureHistorySplices} from './ledger/history.mjs';
|
|
11
11
|
export {replayHistory, sourceBefore, historyProjection, historyProjections, historyPlaces, selectiveUndo, groupHistoryActs, pictureHistorySplices};
|
|
12
12
|
|
|
13
|
-
import {sha256State} from './ledger/hash.mjs';
|
|
14
|
-
export {sha256State};
|
|
13
|
+
import {sha256State, sha256} from './ledger/hash.mjs';
|
|
14
|
+
export {sha256State, sha256};
|
|
15
15
|
import {transposeSource} from './ledger/transport.mjs';
|
|
16
16
|
export {transposeSource};
|
|
17
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapier-markdown-kit",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.17",
|
|
4
4
|
"description": "Read, render and write Self-contained Markdown: one .md file that carries its pictures, drawings and layout, and that any Markdown app can read. HTML renderer, stylesheet, text layout, Will/1 agent permissions, and an edit history with authorship and offline merge. MIT, no dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|