mdast2docx 0.0.0-beta.0 → 0.1.0
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.
- package/README.md +203 -170
- package/dist/chunk-3ZZBJC3M.mjs +1 -0
- package/dist/chunk-7LR5HC5O.mjs +4 -0
- package/dist/chunk-7W4N3GRD.mjs +75 -0
- package/dist/chunk-GM6UUFDK.mjs +2 -0
- package/dist/chunk-TASCVLMX.mjs +1 -0
- package/dist/chunk-UXY5TDOP.mjs +1 -0
- package/dist/chunk-XIRSNIMN.mjs +1 -0
- package/dist/chunk-YKZOUIFR.mjs +1 -0
- package/dist/chunk-Z5DPYROV.mjs +31 -0
- package/dist/chunk-ZKNVKZAF.mjs +1 -0
- package/dist/index.d.ts +7 -8
- package/dist/index.js +2 -38
- package/dist/index.mjs +1 -1
- package/dist/multipart-parser-WKN2UV32.mjs +2 -0
- package/dist/plugins/html.d.ts +0 -0
- package/dist/plugins/html.js +1 -0
- package/dist/plugins/image.d.ts +37 -0
- package/dist/plugins/image.js +1 -0
- package/dist/plugins/image.mjs +1 -0
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.js +75 -0
- package/dist/plugins/index.mjs +1 -0
- package/dist/plugins/list.d.ts +57 -0
- package/dist/plugins/list.js +1 -0
- package/dist/plugins/list.mjs +1 -0
- package/dist/plugins/math.d.ts +11 -0
- package/dist/plugins/math.js +75 -0
- package/dist/plugins/math.mjs +1 -0
- package/dist/plugins/node-image.d.ts +27 -0
- package/dist/plugins/node-image.js +35 -0
- package/dist/plugins/node-image.mjs +1 -0
- package/dist/plugins/node.d.ts +1 -0
- package/dist/plugins/node.js +35 -0
- package/dist/plugins/node.mjs +1 -0
- package/dist/plugins/table.d.ts +26 -0
- package/dist/plugins/table.js +1 -0
- package/dist/plugins/table.mjs +1 -0
- package/dist/section.d.ts +9 -8
- package/dist/section.js +2 -38
- package/dist/section.mjs +1 -1
- package/dist/utils.d.ts +75 -20
- package/dist/utils.js +1 -37
- package/dist/utils.mjs +1 -1
- package/package.json +6 -20
- package/dist/chunk-KRMGJ4HN.mjs +0 -2
- package/dist/chunk-O6BHSWEF.mjs +0 -37
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as f,b as m}from"../chunk-UXY5TDOP.mjs";import{a as o,b as r,c as e}from"../chunk-XIRSNIMN.mjs";import{a as p,b as t}from"../chunk-TASCVLMX.mjs";import"../chunk-YKZOUIFR.mjs";import{a as x,b as a}from"../chunk-7W4N3GRD.mjs";import"../chunk-ZKNVKZAF.mjs";import"../chunk-3ZZBJC3M.mjs";export{o as SUPPORTED_IMAGE_TYPES,p as createLevels,f as defaultTableOptions,r as getImageMimeType,e as imagePlugin,t as listPlugin,a as mathPlugin,x as parseLatex,m as tablePlugin};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ILevelsOptions, LevelFormat } from "@mayank1513/docx";
|
|
2
|
+
import { IPlugin, Optional } from "../utils";
|
|
3
|
+
/**
|
|
4
|
+
* Default options for the list plugin.
|
|
5
|
+
*/
|
|
6
|
+
interface IDefaultListPluginOptions {
|
|
7
|
+
/** Defines the numbering styles for ordered lists. */
|
|
8
|
+
levels: ILevelsOptions[];
|
|
9
|
+
/** Defines the numbering styles for bullet lists (optional). */
|
|
10
|
+
bulletLevels?: ILevelsOptions[];
|
|
11
|
+
/**
|
|
12
|
+
* Bullet characters used for unordered lists.
|
|
13
|
+
* These closely match the default bullets in Microsoft Word.
|
|
14
|
+
*/
|
|
15
|
+
bullets: string[];
|
|
16
|
+
/** If true, uses Word's default bullet styles instead of custom ones. */
|
|
17
|
+
defaultBullets: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** Type representing optional list plugin options. */
|
|
20
|
+
export type IListPluginOptions = Optional<IDefaultListPluginOptions>;
|
|
21
|
+
/**
|
|
22
|
+
* Generates a list of numbering levels for ordered lists.
|
|
23
|
+
*
|
|
24
|
+
* @param levelFormats - An array of level formats defining the numbering style at each level.
|
|
25
|
+
* @param indent - The starting indentation in inches for the first level.
|
|
26
|
+
* @param indentStep - The incremental indentation added for each subsequent level.
|
|
27
|
+
* @returns An array of `ILevelsOptions` defining the hierarchical numbering style.
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
* - Level 1: "1."
|
|
31
|
+
* - Level 2: "1.1."
|
|
32
|
+
* - Level 3: "1.1.1."
|
|
33
|
+
* - Level 4: "A."
|
|
34
|
+
* - Level 5: "a."
|
|
35
|
+
*/
|
|
36
|
+
export declare const createLevels: (levelFormats: (typeof LevelFormat)[keyof typeof LevelFormat][], indent?: number, // Base indentation for the first level (in inches)
|
|
37
|
+
indentStep?: number) => {
|
|
38
|
+
level: number;
|
|
39
|
+
format: "bullet" | "none" | "decimal" | "upperLetter" | "lowerLetter" | "lowerRoman" | "upperRoman" | "ordinal" | "cardinalText" | "ordinalText" | "hex" | "chicago" | "ideographDigital" | "japaneseCounting" | "aiueo" | "iroha" | "decimalFullWidth" | "decimalHalfWidth" | "japaneseLegal" | "japaneseDigitalTenThousand" | "decimalEnclosedCircle" | "decimalFullWidth2" | "aiueoFullWidth" | "irohaFullWidth" | "decimalZero" | "ganada" | "chosung" | "decimalEnclosedFullstop" | "decimalEnclosedParen" | "decimalEnclosedCircleChinese" | "ideographEnclosedCircle" | "ideographTraditional" | "ideographZodiac" | "ideographZodiacTraditional" | "taiwaneseCounting" | "ideographLegalTraditional" | "taiwaneseCountingThousand" | "taiwaneseDigital" | "chineseCounting" | "chineseLegalSimplified" | "chineseCountingThousand" | "koreanDigital" | "koreanCounting" | "koreanLegal" | "koreanDigital2" | "vietnameseCounting" | "russianLower" | "russianUpper" | "numberInDash" | "hebrew1" | "hebrew2" | "arabicAlpha" | "arabicAbjad" | "hindiVowels" | "hindiConsonants" | "hindiNumbers" | "hindiCounting" | "thaiLetters" | "thaiNumbers" | "thaiCounting" | "bahtText" | "dollarText" | "custom";
|
|
40
|
+
text: string;
|
|
41
|
+
alignment: "start";
|
|
42
|
+
style: {
|
|
43
|
+
paragraph: {
|
|
44
|
+
indent: {
|
|
45
|
+
left: number;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}[];
|
|
50
|
+
/**
|
|
51
|
+
* A plugin that enables support for ordered and unordered lists in DOCX.
|
|
52
|
+
*
|
|
53
|
+
* @param options - Optional configuration for customizing lists.
|
|
54
|
+
* @returns An `IPlugin` instance for handling lists in the document.
|
|
55
|
+
*/
|
|
56
|
+
export declare const listPlugin: (options?: IListPluginOptions) => IPlugin;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var f=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var b=(o,t)=>{for(var i in t)f(o,i,{get:t[i],enumerable:!0})},h=(o,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of O(t))!D.call(o,n)&&n!==i&&f(o,n,{get:()=>t[n],enumerable:!(r=m(t,n))||r.enumerable});return o};var C=o=>h(f({},"__esModule",{value:!0}),o);var k={};b(k,{createLevels:()=>I,listPlugin:()=>v});module.exports=C(k);var e=require("@mayank1513/docx");var x=()=>Math.random().toString(16).slice(2);var R=[e.LevelFormat.DECIMAL,e.LevelFormat.DECIMAL,e.LevelFormat.DECIMAL,e.LevelFormat.DECIMAL,e.LevelFormat.UPPER_LETTER,e.LevelFormat.LOWER_LETTER,e.LevelFormat.LOWER_ROMAN,e.LevelFormat.UPPER_ROMAN],I=(o,t=.4,i=.25)=>o.map((r,n)=>({level:n,format:r,text:(r===e.LevelFormat.DECIMAL?Array(n+1).fill(`%${n+1}`).join("."):`%${n+1}`)+".",alignment:e.AlignmentType.START,style:{paragraph:{indent:{left:(0,e.convertInchesToTwip)(t+n*i)}}}})),M=I(R),L=["\u25CF","\u25CB","\u25A0","\u25C6","\u25B6","\u25C9","\u2B24","\u2666","\u25E6","\u25AA"],E={levels:M,bullets:L,defaultBullets:!1},v=o=>{let t=x(),i=`numbering-${t}`,r=`bullet-${t}`,{levels:n,bulletLevels:c,bullets:y,defaultBullets:T}={...E,...o};return{block:async(u,s,l,d)=>{var p,P;if(s.type!=="list")return[];let a=((P=(p=l.bullet)==null?void 0:p.level)!=null?P:-1)+1;return l.numbering=T?void 0:{level:a,reference:s.ordered?i:r},l.bullet={level:a},s.type="",await d(s,l)},root:u=>{var s,l;u.numbering={config:[...(l=(s=u.numbering)==null?void 0:s.config)!=null?l:[],{reference:i,levels:n},{reference:r,levels:c!=null?c:n.map((d,a)=>{var p;return{...d,text:(p=y[a])!=null?p:"\u2022",format:e.LevelFormat.BULLET}})}]}}}};0&&(module.exports={createLevels,listPlugin});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"../chunk-TASCVLMX.mjs";import"../chunk-YKZOUIFR.mjs";import"../chunk-3ZZBJC3M.mjs";export{a as createLevels,b as listPlugin};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IPlugin } from "../utils";
|
|
2
|
+
import * as DOCX from "@mayank1513/docx";
|
|
3
|
+
/** Parse latex and convert to DOCX MathRun nodes */
|
|
4
|
+
export declare const parseLatex: (docx: typeof DOCX, value: string) => DOCX.MathRun[][];
|
|
5
|
+
/**
|
|
6
|
+
* Math Plugin
|
|
7
|
+
*/
|
|
8
|
+
export declare const mathPlugin: () => IPlugin<{
|
|
9
|
+
type: "" | "math" | "inlineMath";
|
|
10
|
+
value?: string;
|
|
11
|
+
}>;
|