md-preview-pdf 1.0.4
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/.editorconfig +37 -0
- package/CHANGELOG.md +405 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +170 -0
- package/LICENSE +21 -0
- package/README.md +391 -0
- package/SECURITY.md +100 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +275 -0
- package/dist/cli.js.map +1 -0
- package/dist/converter.d.ts +58 -0
- package/dist/converter.d.ts.map +1 -0
- package/dist/converter.js +301 -0
- package/dist/converter.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/index.d.ts +40 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +100 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/markdown-parser.d.ts +12 -0
- package/dist/parser/markdown-parser.d.ts.map +1 -0
- package/dist/parser/markdown-parser.js +260 -0
- package/dist/parser/markdown-parser.js.map +1 -0
- package/dist/renderers/html-renderer.d.ts +19 -0
- package/dist/renderers/html-renderer.d.ts.map +1 -0
- package/dist/renderers/html-renderer.js +451 -0
- package/dist/renderers/html-renderer.js.map +1 -0
- package/dist/renderers/index.d.ts +8 -0
- package/dist/renderers/index.d.ts.map +1 -0
- package/dist/renderers/index.js +21 -0
- package/dist/renderers/index.js.map +1 -0
- package/dist/renderers/mermaid-renderer.d.ts +31 -0
- package/dist/renderers/mermaid-renderer.d.ts.map +1 -0
- package/dist/renderers/mermaid-renderer.js +221 -0
- package/dist/renderers/mermaid-renderer.js.map +1 -0
- package/dist/renderers/pdf-renderer.d.ts +40 -0
- package/dist/renderers/pdf-renderer.d.ts.map +1 -0
- package/dist/renderers/pdf-renderer.js +253 -0
- package/dist/renderers/pdf-renderer.js.map +1 -0
- package/dist/themes/github-dark.d.ts +7 -0
- package/dist/themes/github-dark.d.ts.map +1 -0
- package/dist/themes/github-dark.js +400 -0
- package/dist/themes/github-dark.js.map +1 -0
- package/dist/themes/github.d.ts +7 -0
- package/dist/themes/github.d.ts.map +1 -0
- package/dist/themes/github.js +362 -0
- package/dist/themes/github.js.map +1 -0
- package/dist/themes/highlight.d.ts +21 -0
- package/dist/themes/highlight.d.ts.map +1 -0
- package/dist/themes/highlight.js +384 -0
- package/dist/themes/highlight.js.map +1 -0
- package/dist/themes/index.d.ts +41 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +83 -0
- package/dist/themes/index.js.map +1 -0
- package/dist/themes/vscode-dark.d.ts +7 -0
- package/dist/themes/vscode-dark.d.ts.map +1 -0
- package/dist/themes/vscode-dark.js +312 -0
- package/dist/themes/vscode-dark.js.map +1 -0
- package/dist/themes/vscode-light.d.ts +7 -0
- package/dist/themes/vscode-light.d.ts.map +1 -0
- package/dist/themes/vscode-light.js +259 -0
- package/dist/themes/vscode-light.js.map +1 -0
- package/dist/types/index.d.ts +170 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +34 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/error-handler.d.ts +39 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +136 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/file-utils.d.ts +78 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +234 -0
- package/dist/utils/file-utils.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +30 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +61 -0
- package/dist/utils/logger.js.map +1 -0
- package/eslint.config.js +70 -0
- package/index.d.ts +43 -0
- package/package.json +81 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# EditorConfig is awesome: https://EditorConfig.org
|
|
2
|
+
|
|
3
|
+
# top-most EditorConfig file
|
|
4
|
+
root = true
|
|
5
|
+
|
|
6
|
+
# Unix-style newlines with a newline ending every file
|
|
7
|
+
[*]
|
|
8
|
+
end_of_line = lf
|
|
9
|
+
insert_final_newline = true
|
|
10
|
+
charset = utf-8
|
|
11
|
+
trim_trailing_whitespace = true
|
|
12
|
+
|
|
13
|
+
# TypeScript, JavaScript
|
|
14
|
+
[*.{ts,js,tsx,jsx}]
|
|
15
|
+
indent_style = space
|
|
16
|
+
indent_size = 2
|
|
17
|
+
|
|
18
|
+
# JSON
|
|
19
|
+
[*.json]
|
|
20
|
+
indent_style = space
|
|
21
|
+
indent_size = 2
|
|
22
|
+
|
|
23
|
+
# YAML
|
|
24
|
+
[*.{yml,yaml}]
|
|
25
|
+
indent_style = space
|
|
26
|
+
indent_size = 2
|
|
27
|
+
|
|
28
|
+
# Markdown
|
|
29
|
+
[*.md]
|
|
30
|
+
trim_trailing_whitespace = false
|
|
31
|
+
indent_style = space
|
|
32
|
+
indent_size = 2
|
|
33
|
+
|
|
34
|
+
# Package files
|
|
35
|
+
[{package.json,package-lock.json}]
|
|
36
|
+
indent_style = space
|
|
37
|
+
indent_size = 2
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.4] - 2026-01-05
|
|
9
|
+
|
|
10
|
+
### 🎉 First Official Release
|
|
11
|
+
|
|
12
|
+
This is the first stable release of MD Preview PDF Converter with comprehensive Markdown to PDF conversion capabilities.
|
|
13
|
+
|
|
14
|
+
### ✨ Features
|
|
15
|
+
|
|
16
|
+
#### Core Capabilities
|
|
17
|
+
- **Full GFM Support**: Complete GitHub Flavored Markdown support including tables, strikethrough, autolinks
|
|
18
|
+
- **Mermaid Diagrams**: Flowcharts, sequence diagrams, class diagrams, state diagrams, and more
|
|
19
|
+
- **Syntax Highlighting**: 150+ programming languages with beautiful color themes
|
|
20
|
+
- **Math Equations**: Full LaTeX math rendering via KaTeX ($inline$ and $$block$$)
|
|
21
|
+
- **Emoji Support**: GitHub-style emoji conversion (`:emoji:` syntax)
|
|
22
|
+
- **Task Lists**: Interactive checkbox support for TODO lists
|
|
23
|
+
- **Footnotes**: Complete footnote and reference support
|
|
24
|
+
- **Custom Containers**: Tips, warnings, danger, info, note, important, and caution boxes
|
|
25
|
+
- **Table of Contents**: Auto-generated with customizable heading depth (1-6)
|
|
26
|
+
- **Anchors**: Automatic heading anchors for linking
|
|
27
|
+
- **Front Matter**: YAML front matter parsing for document metadata
|
|
28
|
+
|
|
29
|
+
#### Theming & Customization
|
|
30
|
+
- **4 Built-in Themes**:
|
|
31
|
+
- GitHub Light (`github`) - Default, clean professional look
|
|
32
|
+
- GitHub Dark (`github-dark`) - Dark mode with full background coverage
|
|
33
|
+
- VS Code Light (`vscode-light`) - VS Code inspired light theme
|
|
34
|
+
- VS Code Dark (`vscode-dark`) - VS Code inspired dark theme
|
|
35
|
+
- **Custom CSS**: Support for custom CSS file injection
|
|
36
|
+
- **Responsive Rendering**: Automatic page layout adaptation
|
|
37
|
+
- **Custom Headers/Footers**: HTML templates for page headers and footers
|
|
38
|
+
|
|
39
|
+
#### Page Layout & Export
|
|
40
|
+
- **Multiple Page Formats**: A4, A3, A5, Letter, Legal, Tabloid
|
|
41
|
+
- **Custom Margins**: Fully customizable via CLI (`--margin`)
|
|
42
|
+
- **Orientation**: Portrait and landscape support
|
|
43
|
+
- **Page Numbers**: Optional page numbering in footer
|
|
44
|
+
- **HTML Export**: Simultaneous HTML output option
|
|
45
|
+
- **Background Printing**: Control over background color/image printing
|
|
46
|
+
|
|
47
|
+
#### CLI & API
|
|
48
|
+
- **Command Line Interface**: Full-featured CLI with 15+ options
|
|
49
|
+
- **Node.js Module API**: Three export modes:
|
|
50
|
+
- `convert()` - Quick conversion function
|
|
51
|
+
- `Converter` class - Flexible instance-based API
|
|
52
|
+
- `convertString()` - Direct markdown string to PDF buffer
|
|
53
|
+
- **Verbose Logging**: Debug mode with detailed conversion logs
|
|
54
|
+
|
|
55
|
+
### 🔧 Technical Improvements
|
|
56
|
+
|
|
57
|
+
#### Dark Theme Rendering
|
|
58
|
+
- Fixed CSS stylesheet parsing to properly apply theme backgrounds to entire page
|
|
59
|
+
- Dark theme backgrounds now extend to page edges with no white borders
|
|
60
|
+
- Proper margin handling using CSS padding instead of PDF margins
|
|
61
|
+
- Sub-pixel rendering artifacts eliminated via viewport optimization
|
|
62
|
+
|
|
63
|
+
#### Margin & Padding System
|
|
64
|
+
- Redesigned margin handling for better control
|
|
65
|
+
- All margins handled via CSS padding on `.markdown-body`
|
|
66
|
+
- Background colors extend to page edges (no white borders)
|
|
67
|
+
- Default margins optimized at 10mm for professional appearance
|
|
68
|
+
- Custom margin support with format flexibility (`20mm` or `10mm,15mm,20mm,15mm`)
|
|
69
|
+
|
|
70
|
+
#### PDF Generation
|
|
71
|
+
- Viewport set to A4 page dimensions (800x1200px) for consistency
|
|
72
|
+
- Proper font loading and image embedding
|
|
73
|
+
- Optimized Mermaid diagram rendering in browser
|
|
74
|
+
- Comprehensive error handling with graceful fallbacks
|
|
75
|
+
|
|
76
|
+
#### Code Quality
|
|
77
|
+
- **Type Safety**: Full TypeScript with strict typing throughout
|
|
78
|
+
- **ESLint**: 0 warnings with complete type coverage
|
|
79
|
+
- **Tests**: 30 passing tests covering all major features
|
|
80
|
+
- **Dependencies**: 0 npm deprecation warnings, clean dependency tree
|
|
81
|
+
|
|
82
|
+
### 📦 Build & Distribution
|
|
83
|
+
- **Compiled Output**: TypeScript compiled to JavaScript for distribution
|
|
84
|
+
- **CLI Executable**: Global installation support via npm
|
|
85
|
+
- **Source Maps**: Full debugging support with sourcemap generation
|
|
86
|
+
- **Module Exports**: ESM/CommonJS compatible exports
|
|
87
|
+
|
|
88
|
+
### 🧪 Testing & Verification
|
|
89
|
+
|
|
90
|
+
**Unit Tests: 30/30 Passing** ✅
|
|
91
|
+
- Markdown parsing (12 tests)
|
|
92
|
+
- Front matter (2 tests)
|
|
93
|
+
- Converter operations (2 tests)
|
|
94
|
+
- Integration tests (3 tests)
|
|
95
|
+
- Feature coverage (11 tests)
|
|
96
|
+
|
|
97
|
+
**CLI Validation: 11/11 Passing** ✅
|
|
98
|
+
- Basic conversion
|
|
99
|
+
- Theme selection (4 themes)
|
|
100
|
+
- Table of Contents
|
|
101
|
+
- Custom margins
|
|
102
|
+
- HTML output
|
|
103
|
+
- Page numbers
|
|
104
|
+
- Feature toggles
|
|
105
|
+
- Page formats
|
|
106
|
+
- Landscape orientation
|
|
107
|
+
|
|
108
|
+
**Module API: 5/5 Passing** ✅
|
|
109
|
+
- Quick convert function
|
|
110
|
+
- Converter class with options
|
|
111
|
+
- TOC generation
|
|
112
|
+
- Markdown string conversion
|
|
113
|
+
- Multiple theme rendering
|
|
114
|
+
|
|
115
|
+
**Feature Verification: 14/14 Passing** ✅
|
|
116
|
+
- All features listed in README verified
|
|
117
|
+
- All documentation examples tested
|
|
118
|
+
- Architecture diagram components validated
|
|
119
|
+
|
|
120
|
+
### 📋 CLI Reference
|
|
121
|
+
|
|
122
|
+
**Basic Usage**
|
|
123
|
+
```bash
|
|
124
|
+
md-preview-pdf document.md
|
|
125
|
+
md-preview-pdf document.md output.pdf
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Common Options**
|
|
129
|
+
```bash
|
|
130
|
+
--theme <theme> # github, github-dark, vscode-light, vscode-dark
|
|
131
|
+
--toc # Generate table of contents
|
|
132
|
+
--margin <size> # Custom margins (e.g., 25mm or 10mm,15mm,20mm,15mm)
|
|
133
|
+
--page-numbers # Add page numbers to footer
|
|
134
|
+
--format <format> # A4, A3, A5, Letter, Legal, Tabloid
|
|
135
|
+
--landscape # Landscape orientation
|
|
136
|
+
--html # Also output HTML file
|
|
137
|
+
--no-math # Disable KaTeX rendering
|
|
138
|
+
--no-emoji # Disable emoji conversion
|
|
139
|
+
--no-highlight # Disable syntax highlighting
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**List Available Themes**
|
|
143
|
+
```bash
|
|
144
|
+
md-preview-pdf themes
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 🚀 Node.js API
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
import { Converter, convert, convertString } from 'md-preview-pdf';
|
|
151
|
+
|
|
152
|
+
// Quick convert
|
|
153
|
+
await convert('input.md', 'output.pdf', { theme: { name: 'github-dark' } });
|
|
154
|
+
|
|
155
|
+
// Converter class
|
|
156
|
+
const converter = new Converter({ theme: { name: 'github-dark' }, toc: true });
|
|
157
|
+
await converter.convertFile('input.md', 'output.pdf');
|
|
158
|
+
await converter.cleanup();
|
|
159
|
+
|
|
160
|
+
// String to PDF
|
|
161
|
+
const pdfBuffer = await convertString('# Hello\nWorld', { theme: { name: 'github' } });
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 💻 System Requirements
|
|
165
|
+
- **Node.js**: >= 18.0.0
|
|
166
|
+
- **npm**: >= 8.0.0
|
|
167
|
+
- **Chromium**: Automatically downloaded by Puppeteer
|
|
168
|
+
- **Memory**: 512MB minimum (1GB+ recommended for large documents)
|
|
169
|
+
|
|
170
|
+
### 📄 Documentation
|
|
171
|
+
- **README.md**: Quick start guide and feature overview
|
|
172
|
+
- **ARCHITECTURE.md**: Detailed system design and component breakdown
|
|
173
|
+
- **CONTRIBUTING.md**: Contribution guidelines
|
|
174
|
+
- **CODE_OF_CONDUCT.md**: Community standards
|
|
175
|
+
|
|
176
|
+
### 🐛 Known Limitations
|
|
177
|
+
- Sub-pixel rendering may produce minimal artifacts on PDF edges (Puppeteer limitation)
|
|
178
|
+
- Very large documents (1000+ pages) may require increased memory
|
|
179
|
+
- Some rare CSS edge cases may not render identically to web browsers
|
|
180
|
+
- Mermaid diagram complexity is limited by browser rendering
|
|
181
|
+
|
|
182
|
+
### 🎯 Performance Benchmarks
|
|
183
|
+
- Simple markdown file: ~2.1 seconds
|
|
184
|
+
- Comprehensive document: ~40 seconds
|
|
185
|
+
- Small document PDF: 100-150 KB
|
|
186
|
+
- Typical document PDF: 500KB-2MB
|
|
187
|
+
|
|
188
|
+
### ✅ Verification Checklist
|
|
189
|
+
- ✅ Build: 0 errors
|
|
190
|
+
- ✅ Linting: 0 errors, 0 warnings
|
|
191
|
+
- ✅ Tests: 30/30 passing
|
|
192
|
+
- ✅ npm audit: 0 vulnerabilities
|
|
193
|
+
- ✅ CLI: All commands working
|
|
194
|
+
- ✅ API: All methods functional
|
|
195
|
+
- ✅ Themes: All 4 rendering correctly
|
|
196
|
+
- ✅ Features: 14/14 verified
|
|
197
|
+
- ✅ Documentation: Complete and tested
|
|
198
|
+
|
|
199
|
+
### 🙏 Attribution
|
|
200
|
+
- Built with [Puppeteer](https://github.com/puppeteer/puppeteer) for PDF generation
|
|
201
|
+
- [markdown-it](https://github.com/markdown-it/markdown-it) for parsing
|
|
202
|
+
- [highlight.js](https://highlightjs.org/) for syntax highlighting
|
|
203
|
+
- [KaTeX](https://katex.org/) for math rendering
|
|
204
|
+
- [Mermaid](https://mermaid.js.org/) for diagrams
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## [1.0.3] - 2026-01-04
|
|
209
|
+
|
|
210
|
+
### Fixed
|
|
211
|
+
- **Eliminated all npm deprecation warnings using npm overrides**
|
|
212
|
+
- Previously: `npm warn deprecated inflight@1.0.6` and `npm warn deprecated glob@7.2.3`
|
|
213
|
+
- Root cause: `test-exclude@6.0.0` (used by babel-plugin-istanbul) depended on glob@7.2.3 and inflight@1.0.6
|
|
214
|
+
- Solution: Added npm overrides to force `test-exclude@7.0.1` which uses `glob@10.5.0` (no inflight dependency)
|
|
215
|
+
- Result: 0 npm deprecation warnings
|
|
216
|
+
|
|
217
|
+
### Changed
|
|
218
|
+
- **package.json**: Added `overrides` field with `test-exclude@^7.0.1`
|
|
219
|
+
- This forces the latest test-exclude version across the entire dependency tree
|
|
220
|
+
- Ensures no transitive deprecated dependencies are installed
|
|
221
|
+
- npm overrides field is the official npm solution for this type of issue
|
|
222
|
+
|
|
223
|
+
### Improvements
|
|
224
|
+
- Complete elimination of npm deprecation warnings from direct and transitive dependencies
|
|
225
|
+
- Cleaner dependency tree with no memory-leaking modules (inflight is deprecated)
|
|
226
|
+
- Faster glob operations using modern glob@10 implementation
|
|
227
|
+
- All dependencies verified with `npm audit` (0 vulnerabilities)
|
|
228
|
+
|
|
229
|
+
### Verification
|
|
230
|
+
- ✅ Build: 0 errors
|
|
231
|
+
- ✅ Linting: 0 errors, 0 warnings
|
|
232
|
+
- ✅ Tests: 26/26 passing
|
|
233
|
+
- ✅ npm audit: 0 vulnerabilities
|
|
234
|
+
- ✅ npm ci: Clean install with 0 deprecation warnings
|
|
235
|
+
- ✅ npm ls: Correct dependency tree (test-exclude@7.0.1, glob@10.5.0, no inflight)
|
|
236
|
+
- ✅ CLI: All commands working correctly
|
|
237
|
+
- ✅ Programmatic API: All Converter methods functional
|
|
238
|
+
|
|
239
|
+
## [1.0.2] - 2026-01-04
|
|
240
|
+
|
|
241
|
+
### Fixed
|
|
242
|
+
- **Eliminated all ESLint warnings with proper type safety**
|
|
243
|
+
- Previously: 15 ESLint warnings about "Unexpected any" types
|
|
244
|
+
- Now: 0 ESLint warnings with full type safety
|
|
245
|
+
- Fixed CLI `mermaidTheme` option: Changed from `any` to proper `MermaidOptions['theme']` type
|
|
246
|
+
- Fixed markdown-it integration: Properly imported and used `Token`, `StateInline`, `StateBlock` types from markdown-it/lib
|
|
247
|
+
- Fixed all render rule callbacks: Now use proper `Renderer.RenderRule` type with correct function signatures
|
|
248
|
+
- Fixed unused function parameters: All unused parameters now properly prefixed with `_` prefix
|
|
249
|
+
|
|
250
|
+
### Changed
|
|
251
|
+
- **CLI Type Safety** (`src/cli.ts`):
|
|
252
|
+
- Line 180: `mermaidTheme` now typed as `MermaidOptions['theme']` instead of `any`
|
|
253
|
+
- Added import of `MermaidOptions` type for proper type checking
|
|
254
|
+
- **Markdown Parser Proper Typing** (`src/parser/markdown-parser.ts`):
|
|
255
|
+
- Imported actual markdown-it types: `Token`, `StateInline`, `StateBlock`, `Renderer`
|
|
256
|
+
- All render function callbacks now use `Renderer.RenderRule` type
|
|
257
|
+
- Math render rules: `tokens: Token[]` with proper typing
|
|
258
|
+
- Mermaid fence handler: Full type safety with `_options`, `_env`, `_self` parameters
|
|
259
|
+
- Container render rules: Both standard containers and details/summary use proper types
|
|
260
|
+
- All unused parameters properly marked with `_` prefix per ESLint conventions
|
|
261
|
+
|
|
262
|
+
### Improvements
|
|
263
|
+
- Complete elimination of ESLint warnings without using `eslint-disable` comments
|
|
264
|
+
- Improved code maintainability with proper TypeScript types throughout
|
|
265
|
+
- Better IDE support with full type inference for markdown-it integration
|
|
266
|
+
- All type imports come directly from markdown-it's official type definitions
|
|
267
|
+
|
|
268
|
+
### Verification
|
|
269
|
+
- ✅ Build: 0 errors
|
|
270
|
+
- ✅ Linting: 0 errors, 0 warnings (previously 15 warnings)
|
|
271
|
+
- ✅ Tests: 26/26 passing
|
|
272
|
+
- ✅ npm audit: 0 vulnerabilities
|
|
273
|
+
|
|
274
|
+
## [1.0.2] - 2026-01-04
|
|
275
|
+
|
|
276
|
+
### Fixed
|
|
277
|
+
- **Eliminated all ESLint warnings with proper type safety**
|
|
278
|
+
- Previously: 15 ESLint warnings about "Unexpected any" types
|
|
279
|
+
- Now: 0 ESLint warnings with full type safety
|
|
280
|
+
- Fixed CLI `mermaidTheme` option: Changed from `any` to proper `MermaidOptions['theme']` type
|
|
281
|
+
- Fixed markdown-it integration: Properly imported and used `Token`, `StateInline`, `StateBlock` types from markdown-it/lib
|
|
282
|
+
- Fixed all render rule callbacks: Now use proper `Renderer.RenderRule` type with correct function signatures
|
|
283
|
+
- Fixed unused function parameters: All unused parameters now properly prefixed with `_` prefix
|
|
284
|
+
|
|
285
|
+
### Changed
|
|
286
|
+
- **CLI Type Safety** (`src/cli.ts`):
|
|
287
|
+
- Line 180: `mermaidTheme` now typed as `MermaidOptions['theme']` instead of `any`
|
|
288
|
+
- Added import of `MermaidOptions` type for proper type checking
|
|
289
|
+
- **Markdown Parser Proper Typing** (`src/parser/markdown-parser.ts`):
|
|
290
|
+
- Imported actual markdown-it types: `Token`, `StateInline`, `StateBlock`, `Renderer`
|
|
291
|
+
- All render function callbacks now use `Renderer.RenderRule` type
|
|
292
|
+
- Math render rules: `tokens: Token[]` with proper typing
|
|
293
|
+
- Mermaid fence handler: Full type safety with `_options`, `_env`, `_self` parameters
|
|
294
|
+
- Container render rules: Both standard containers and details/summary use proper types
|
|
295
|
+
- All unused parameters properly marked with `_` prefix per ESLint conventions
|
|
296
|
+
|
|
297
|
+
### Improvements
|
|
298
|
+
- Complete elimination of ESLint warnings without using `eslint-disable` comments
|
|
299
|
+
- Improved code maintainability with proper TypeScript types throughout
|
|
300
|
+
- Better IDE support with full type inference for markdown-it integration
|
|
301
|
+
- All type imports come directly from markdown-it's official type definitions
|
|
302
|
+
|
|
303
|
+
### Verification
|
|
304
|
+
- ✅ Build: 0 errors
|
|
305
|
+
- ✅ Linting: 0 errors, 0 warnings (previously 15 warnings)
|
|
306
|
+
- ✅ Tests: 26/26 passing
|
|
307
|
+
- ✅ npm audit: 0 vulnerabilities
|
|
308
|
+
|
|
309
|
+
## [1.0.1] - 2026-01-04
|
|
310
|
+
|
|
311
|
+
### Fixed
|
|
312
|
+
- **Resolved all npm deprecation warnings from direct dependencies**
|
|
313
|
+
- Previously warned about @humanwhocodes/config-array and @humanwhocodes/object-schema (ESLint v8 dependencies)
|
|
314
|
+
- Previously warned about inflight, rimraf@3, glob@7, and eslint@8.57.1
|
|
315
|
+
- Upgraded ESLint from v8.57.0 → v9.0.0 (latest stable, fully supported)
|
|
316
|
+
- Upgraded @typescript-eslint/parser from v6.17.0 → v8.0.0 (latest compatible)
|
|
317
|
+
- Upgraded @typescript-eslint/eslint-plugin from v6.17.0 → v8.0.0 (latest compatible)
|
|
318
|
+
- Upgraded TypeScript from v5.3.3 → v5.4.5 (latest stable)
|
|
319
|
+
- Upgraded all other dev dependencies to latest stable versions
|
|
320
|
+
- Fixed ESLint configuration for v9 compatibility
|
|
321
|
+
|
|
322
|
+
### Changed
|
|
323
|
+
- **ESLint Configuration**: Migrated from old config format (.eslintrc.js) to new flat config format (eslint.config.js)
|
|
324
|
+
- ESLint config properly handles:
|
|
325
|
+
- JavaScript config files (eslint.config.js, jest.config.js) with CommonJS require statements
|
|
326
|
+
- TypeScript source files (src/**/*.ts) with full type checking
|
|
327
|
+
- Test files (tests/**/*.ts) without type project validation
|
|
328
|
+
- Updated ECMAScript version target to 2024
|
|
329
|
+
- Added typescript-eslint package for proper ESLint v9 support
|
|
330
|
+
- Removed unused `convert` import from tests
|
|
331
|
+
|
|
332
|
+
### Improvements
|
|
333
|
+
- All direct npm dependencies now use latest stable versions with no known vulnerabilities
|
|
334
|
+
- ESLint security patches (v9 has critical security improvements over v8)
|
|
335
|
+
- Cleaner dependency management with no deprecated warnings from direct dependencies
|
|
336
|
+
- Better type safety and linting rules with @typescript-eslint v8
|
|
337
|
+
|
|
338
|
+
### Technical Details
|
|
339
|
+
**Transitive Dependencies Note:** Remaining npm warnings from `inflight@1.0.6` and `glob@7.2.3` are from transitive dependencies used by Jest. These are indirect and cannot be controlled directly (Jest still uses these older tools). No direct dependencies produce warnings.
|
|
340
|
+
|
|
341
|
+
**Verification:**
|
|
342
|
+
- ✅ All 26 tests passing
|
|
343
|
+
- ✅ Build successful with TypeScript 5.4.5
|
|
344
|
+
- ✅ ESLint: 0 errors (2 warnings are intentional: any type usage in CLI)
|
|
345
|
+
- ✅ npm audit: 0 vulnerabilities
|
|
346
|
+
- ✅ npm ci: Clean install with only transitive deprecation warnings
|
|
347
|
+
|
|
348
|
+
## [1.0.0] - 2026-01-03
|
|
349
|
+
|
|
350
|
+
### Added
|
|
351
|
+
- Initial release of MD Preview PDF
|
|
352
|
+
- Full GitHub Flavored Markdown (GFM) support
|
|
353
|
+
- Mermaid diagram rendering (flowcharts, sequence diagrams, class diagrams, etc.)
|
|
354
|
+
- Syntax highlighting for 150+ programming languages using highlight.js
|
|
355
|
+
- Math equation rendering with KaTeX
|
|
356
|
+
- Multiple themes: GitHub (light/dark), VS Code (light/dark)
|
|
357
|
+
- Auto-generated Table of Contents with customizable depth
|
|
358
|
+
- Task lists with checkbox support
|
|
359
|
+
- Footnotes support
|
|
360
|
+
- Custom containers (tips, warnings, info boxes)
|
|
361
|
+
- Emoji shortcode conversion
|
|
362
|
+
- Command-line interface with extensive options
|
|
363
|
+
- Programmatic API for integration
|
|
364
|
+
- YAML front matter support for document-specific configuration
|
|
365
|
+
- Custom CSS support
|
|
366
|
+
- Page number support
|
|
367
|
+
- Landscape and portrait orientation options
|
|
368
|
+
- Multiple page formats (A4, A3, A5, Letter, Legal, Tabloid)
|
|
369
|
+
- Customizable margins
|
|
370
|
+
- Debug mode for troubleshooting
|
|
371
|
+
|
|
372
|
+
### Fixed
|
|
373
|
+
- Missing headings in PDF output (critical bug fix)
|
|
374
|
+
- Excessive white space around Mermaid diagrams
|
|
375
|
+
- Excessive white space between sections
|
|
376
|
+
- Mermaid diagrams breaking across pages
|
|
377
|
+
- Headings appearing separately from their content
|
|
378
|
+
- Improved page break control for tables, images, and code blocks
|
|
379
|
+
|
|
380
|
+
### Technical
|
|
381
|
+
- TypeScript-based codebase for type safety
|
|
382
|
+
- Puppeteer for high-fidelity PDF generation
|
|
383
|
+
- Comprehensive test suite with Jest
|
|
384
|
+
- ESLint configuration for code quality
|
|
385
|
+
- Modular architecture with clear separation of concerns
|
|
386
|
+
- Async/await throughout for better performance
|
|
387
|
+
- Error handling and logging utilities
|
|
388
|
+
|
|
389
|
+
## [Unreleased]
|
|
390
|
+
|
|
391
|
+
### Planned
|
|
392
|
+
- Watch mode for automatic regeneration
|
|
393
|
+
- Batch conversion support
|
|
394
|
+
- Additional themes
|
|
395
|
+
- SVG optimization
|
|
396
|
+
- Custom font support
|
|
397
|
+
- Header/footer templates
|
|
398
|
+
- Watermark support
|
|
399
|
+
- PDF encryption and permissions
|
|
400
|
+
- Table of figures/tables
|
|
401
|
+
- Cross-references
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
[1.0.0]: https://github.com/anuragkr29/md-preview-pdf/releases/tag/v1.0.0
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
[anuragkr29@outlook.com].
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
123
|
+
|
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
|
125
|
+
|
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
+
https://www.contributor-covenant.org/translations.
|