md2gost 1.3.0 → 1.3.1
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/CHANGELOG.md +219 -0
- package/LICENSE +21 -21
- package/assets/run.ps1 +61 -61
- package/assets/styles.xml +1140 -1140
- package/dist/{index.cjs → index.js} +13 -10
- package/dist/{index.cjs.map → index.js.map} +2 -2
- package/dist/index.mjs +4 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +223 -227
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
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.1.0/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
### Changed
|
|
11
|
+
### Deprecated
|
|
12
|
+
### Removed
|
|
13
|
+
### Fixed
|
|
14
|
+
### Security
|
|
15
|
+
|
|
16
|
+
## [1.3.1] - 2026-07-09
|
|
17
|
+
### Fixed
|
|
18
|
+
- assert that macros are enabled for pdf output format
|
|
19
|
+
- fix import in CLI
|
|
20
|
+
|
|
21
|
+
## [1.3.0] - 2026-07-09
|
|
22
|
+
### Added
|
|
23
|
+
- NPM package support alongside the existing VS Code extension (dual distribution).
|
|
24
|
+
- Command Line Interface (CLI) powered by `commander`.
|
|
25
|
+
|
|
26
|
+
## [1.2.2] - 2026-05-27
|
|
27
|
+
### Changed
|
|
28
|
+
- allow simple list in "СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ"
|
|
29
|
+
### Fixed
|
|
30
|
+
- fix macros on non-Russian system locales
|
|
31
|
+
- add count of appendices in "РЕФЕРАТ"
|
|
32
|
+
|
|
33
|
+
## [1.2.1] - 2026-05-23
|
|
34
|
+
### Fixed
|
|
35
|
+
- fix link parsing
|
|
36
|
+
- fix sources list parsing
|
|
37
|
+
- fix macros for large docs
|
|
38
|
+
- fix AutoListingContinuation
|
|
39
|
+
- fix count of elements in "РЕФЕРАТ"
|
|
40
|
+
- keep table and code caption styles in continuations
|
|
41
|
+
|
|
42
|
+
## [1.2.0] - 2026-05-21
|
|
43
|
+
### Added
|
|
44
|
+
- support Appendix section
|
|
45
|
+
- new rules to configure styles
|
|
46
|
+
- support multiline markdown comments
|
|
47
|
+
- `md2gost.completion.tableSeparator` and `md2gost.completion.listItem` options to toggle text suggestions
|
|
48
|
+
- `md2gost.render.removeIntermediateDocx` option to clean up temporary DOCX file after PDF generation
|
|
49
|
+
### Changed
|
|
50
|
+
- rename option `md2gost.ui.enhancedMarkdownPreview` to `md2gost.ui.enhancedPreview`
|
|
51
|
+
- rename option `md2gost.ui.disableHighlighting` to `md2gost.ui.enhancedHighlighting`
|
|
52
|
+
### Fixed
|
|
53
|
+
- support for triple-backtick (```) blocks in paragraph text
|
|
54
|
+
- AutoTableContinuation: dont left single row at page
|
|
55
|
+
- fix formatter: skip text inside triple-backtick (```) blocks
|
|
56
|
+
- fix formatter: keep em dashes inside "СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ"
|
|
57
|
+
- fix list formatting
|
|
58
|
+
- fix json parsing in rendering to PDF
|
|
59
|
+
- fix macros on non-Russian system locales
|
|
60
|
+
- fix custom md syntax highlighting
|
|
61
|
+
|
|
62
|
+
## [1.1.1] - 2026-05-10
|
|
63
|
+
### Fixed
|
|
64
|
+
- fix titles in Markdown preview
|
|
65
|
+
|
|
66
|
+
## [1.1.0] - 2026-05-09
|
|
67
|
+
### Added
|
|
68
|
+
- new rules to configure styles
|
|
69
|
+
- echance Markdown preview to support custom syntax
|
|
70
|
+
- show warnings for uncorrect rules
|
|
71
|
+
- add "open readme" button
|
|
72
|
+
### Fixed
|
|
73
|
+
- fix render of section without page numbers
|
|
74
|
+
- enable table editor for all md files
|
|
75
|
+
|
|
76
|
+
## [1.0.3] - 2026-04-26
|
|
77
|
+
### Added
|
|
78
|
+
- html codes: `« » ‹ ›` for `« » ‹ ›`
|
|
79
|
+
### Fixed
|
|
80
|
+
- fix quote replacement for non‑ASCII characters and punctuation after closing quotes
|
|
81
|
+
- add missing intellisense
|
|
82
|
+
- fix AutoListingContinuation
|
|
83
|
+
|
|
84
|
+
## [1.0.1] - 2026-04-26
|
|
85
|
+
### Fixed
|
|
86
|
+
- convert `⋆` to `*`
|
|
87
|
+
|
|
88
|
+
## [1.0.0] - 2026-04-26
|
|
89
|
+
### Added
|
|
90
|
+
- intellisense (CompletionItem, InlineCompletionItem, Hover, InlayHints)
|
|
91
|
+
- formatter
|
|
92
|
+
- table editor
|
|
93
|
+
- html codes for ~60 symbol (e.g. `π` to `π`)
|
|
94
|
+
- add AutoTableContinuation
|
|
95
|
+
- feature: sources list
|
|
96
|
+
- allow pdf in doc include
|
|
97
|
+
### Changed
|
|
98
|
+
- rule `backtick_mono`: `off` - no style now, added `italic` option instead
|
|
99
|
+
### Fixed
|
|
100
|
+
- fix one-column table parsing
|
|
101
|
+
- allow table title without newline
|
|
102
|
+
- signicantly speed up vba macros (up to 20 times)
|
|
103
|
+
- fix (allow) svg images
|
|
104
|
+
- fix metadata changes lost
|
|
105
|
+
|
|
106
|
+
## [0.7.0] - 2026-04-07
|
|
107
|
+
### Added
|
|
108
|
+
- convert `⋆` to `*`
|
|
109
|
+
- table columns alignment with colon
|
|
110
|
+
- parse ``` `abc` ``` as monotext, render as italic if backtick_mono is off (default)
|
|
111
|
+
- new rule: `!!rule backtick_mono <off/on/outline>`
|
|
112
|
+
- new rule: `!!rule numbering lazy <off/on>`
|
|
113
|
+
### Fixed
|
|
114
|
+
- fix disappearing stars due to text style parsing
|
|
115
|
+
- fix list indent when >= 10 items
|
|
116
|
+
- fix quotes replacing ("a "b" c": «a »b« c» to «a «b» c»)
|
|
117
|
+
- fix docx include when not in the beginning
|
|
118
|
+
- fix `<br>` duplication
|
|
119
|
+
|
|
120
|
+
## [0.6.1] - 2026-03-10
|
|
121
|
+
### Added
|
|
122
|
+
- show what's new page on update
|
|
123
|
+
|
|
124
|
+
## [0.6.0] - 2026-03-07
|
|
125
|
+
### Added
|
|
126
|
+
- autonumbering by `[#]`, `[ref_id]`
|
|
127
|
+
- refs by `[ref_id]` - allowed chars: a-z A-Z а-я А-Я ёЁ _ 0-9
|
|
128
|
+
- text vars `[!pages]` `[!imgs]` `[!tables]` `[!codes]` `[!sources]`
|
|
129
|
+
- new rules: `!!rule numbering sections <on/off>` `!!rule numbering autoprefix <on/off>`
|
|
130
|
+
- fast render without postprocessing (hold alt when click render button)
|
|
131
|
+
### Fixed
|
|
132
|
+
- warn message if not win32 instead of error
|
|
133
|
+
- black background with `!!rule rainbow`
|
|
134
|
+
- fix img path from project root: treat `/img.png` as `./img.png`
|
|
135
|
+
- correct work with img path in `<>` like `<img.png>`
|
|
136
|
+
|
|
137
|
+
## [0.5.2] - 2026-02-27
|
|
138
|
+
### Fixed
|
|
139
|
+
- detect ru/en language in text for correct markup
|
|
140
|
+
- better error messages
|
|
141
|
+
- stretch tables to full page width
|
|
142
|
+
- dont crash if cant run PS or on PS error
|
|
143
|
+
|
|
144
|
+
## [0.5.1] - 2026-02-18
|
|
145
|
+
### Added
|
|
146
|
+
- replacing `---` with page break
|
|
147
|
+
### Fixed
|
|
148
|
+
- fix using absolute path for images and external doc
|
|
149
|
+
- save .md file before rendering
|
|
150
|
+
|
|
151
|
+
## [0.5.0] - 2026-02-18
|
|
152
|
+
### Added
|
|
153
|
+
- insert non-breaking space by ` `
|
|
154
|
+
- insert tab by `	`
|
|
155
|
+
- prevent text stretching due to line breaks
|
|
156
|
+
- new rule rainbow: `!!rule rainbow`
|
|
157
|
+
- set in doc: edit time (random in 30-120), creation time (as in .md), modification time (now)
|
|
158
|
+
- new rules: `!!rule etime <int>`, `!!rule ctime <ISO 8601>`, `!!rule mtime <ISO 8601>`
|
|
159
|
+
### Fixed
|
|
160
|
+
- fix doc include parsing
|
|
161
|
+
- prevent empty image title
|
|
162
|
+
|
|
163
|
+
## [0.4.0] - 2026-02-17
|
|
164
|
+
### Added
|
|
165
|
+
- new rule to set title of document: `!!rule title My great title`
|
|
166
|
+
- new rule to set author of document: `!!rule author My name`
|
|
167
|
+
|
|
168
|
+
## [0.3.1] - 2026-02-17
|
|
169
|
+
### Fixed
|
|
170
|
+
- syntax highlighting: remove bold style
|
|
171
|
+
|
|
172
|
+
## [0.3.0] - 2026-02-17
|
|
173
|
+
### Added
|
|
174
|
+
- syntax highlighting in code blocks
|
|
175
|
+
- is enabled by adding `!!rule highlight code` anywhere in file
|
|
176
|
+
- suports: html, xml, css, js, ts, jsx, tsx, json, bash, powershell, python, java, c, cpp, csharp, go, rust, php, ruby, swift, kotlin, sql, yaml, markdown, docker, nginx
|
|
177
|
+
|
|
178
|
+
## [0.2.1] - 2026-02-17
|
|
179
|
+
### Added
|
|
180
|
+
- replacing quotes: "abc" to «abc»
|
|
181
|
+
|
|
182
|
+
## [0.2.0] - 2026-02-17
|
|
183
|
+
### Added
|
|
184
|
+
- break line by `<br>`
|
|
185
|
+
- text decorations parsing: bold, italic, links
|
|
186
|
+
### Fixed
|
|
187
|
+
- disable row spliting in table
|
|
188
|
+
|
|
189
|
+
## [0.1.7] - 2026-02-15
|
|
190
|
+
### Fixed
|
|
191
|
+
- fix AutoListingContinuation
|
|
192
|
+
|
|
193
|
+
## [0.1.6] - 2026-02-15
|
|
194
|
+
### Fixed
|
|
195
|
+
- greatly fix PDF render
|
|
196
|
+
|
|
197
|
+
## [0.1.5] - 2026-02-15
|
|
198
|
+
### Fixed
|
|
199
|
+
- list: dont auto-lower first char
|
|
200
|
+
|
|
201
|
+
## [0.1.4] - 2026-02-15
|
|
202
|
+
### Fixed
|
|
203
|
+
- fix readme
|
|
204
|
+
|
|
205
|
+
## [0.1.3] - 2026-02-15
|
|
206
|
+
### Added
|
|
207
|
+
- replacing "ai" dashes with common dash
|
|
208
|
+
### Fixed
|
|
209
|
+
- list: dont auto-lower first char if second is uppercase
|
|
210
|
+
- ToC title uppercase
|
|
211
|
+
- improve readme
|
|
212
|
+
|
|
213
|
+
## [0.1.2] - 2026-02-13
|
|
214
|
+
### Fixed
|
|
215
|
+
- Correct parsing of tables and lists
|
|
216
|
+
|
|
217
|
+
## [0.1.0] - 2026-02-13
|
|
218
|
+
### Added
|
|
219
|
+
- basic functionality
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Mike
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mike
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/assets/run.ps1
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
param (
|
|
2
|
-
[string]$InputDoc,
|
|
3
|
-
[string]$OutputDoc,
|
|
4
|
-
[string]$MacroTemplate,
|
|
5
|
-
[switch]$RenderPDF
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (-not $InputDoc) { throw "The input file is not defined" }
|
|
10
|
-
if (-not $OutputDoc) { throw "The output file is not defined" }
|
|
11
|
-
if (-not $MacroTemplate) { throw "The macro template file is not defined" }
|
|
12
|
-
|
|
13
|
-
# --- Проверки --------------------------------------------------
|
|
14
|
-
|
|
15
|
-
if (-not (Test-Path $InputDoc)) {
|
|
16
|
-
throw "The input file was not found: $InputDoc"
|
|
17
|
-
}
|
|
18
|
-
if (-not (Test-Path $MacroTemplate)) {
|
|
19
|
-
throw "The macro file was not found: $MacroTemplate"
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
$InputDoc = [System.IO.Path]::GetFullPath($InputDoc)
|
|
23
|
-
$OutputDoc = [System.IO.Path]::GetFullPath($OutputDoc)
|
|
24
|
-
$MacroTemplate = [System.IO.Path]::GetFullPath($MacroTemplate)
|
|
25
|
-
|
|
26
|
-
# --- Word ------------------------------------------------------
|
|
27
|
-
|
|
28
|
-
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8;
|
|
29
|
-
|
|
30
|
-
$word = New-Object -ComObject Word.Application
|
|
31
|
-
$word.Visible = $false
|
|
32
|
-
$word.DisplayAlerts = 0
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
# Подключаем глобальный шаблон
|
|
36
|
-
$word.AddIns.Add($MacroTemplate, $true)
|
|
37
|
-
|
|
38
|
-
$doc = $word.Documents.Open($InputDoc)
|
|
39
|
-
|
|
40
|
-
# --- Generating -------------------------------------------
|
|
41
|
-
Write-Host "[*1] Generating continued listings..."
|
|
42
|
-
$word.Run("AutoListingContinuation")
|
|
43
|
-
|
|
44
|
-
Write-Host "[*2] Generating continued tables..."
|
|
45
|
-
$word.Run("AutoTableContinuation")
|
|
46
|
-
|
|
47
|
-
# --- Saving -----------------------------------------------
|
|
48
|
-
$doc.SaveAs($OutputDoc, 16)
|
|
49
|
-
|
|
50
|
-
if ($RenderPDF) {
|
|
51
|
-
Write-Host "[*3] Render to PDF..."
|
|
52
|
-
$word.Run("RenderSegmentsToPDF")
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
$doc.Close($false)
|
|
56
|
-
Write-Host "Done: $OutputDoc"
|
|
57
|
-
}
|
|
58
|
-
finally {
|
|
59
|
-
$word.Quit()
|
|
60
|
-
[System.Runtime.InteropServices.Marshal]::ReleaseComObject($word) | Out-Null
|
|
61
|
-
}
|
|
1
|
+
param (
|
|
2
|
+
[string]$InputDoc,
|
|
3
|
+
[string]$OutputDoc,
|
|
4
|
+
[string]$MacroTemplate,
|
|
5
|
+
[switch]$RenderPDF
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
if (-not $InputDoc) { throw "The input file is not defined" }
|
|
10
|
+
if (-not $OutputDoc) { throw "The output file is not defined" }
|
|
11
|
+
if (-not $MacroTemplate) { throw "The macro template file is not defined" }
|
|
12
|
+
|
|
13
|
+
# --- Проверки --------------------------------------------------
|
|
14
|
+
|
|
15
|
+
if (-not (Test-Path $InputDoc)) {
|
|
16
|
+
throw "The input file was not found: $InputDoc"
|
|
17
|
+
}
|
|
18
|
+
if (-not (Test-Path $MacroTemplate)) {
|
|
19
|
+
throw "The macro file was not found: $MacroTemplate"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$InputDoc = [System.IO.Path]::GetFullPath($InputDoc)
|
|
23
|
+
$OutputDoc = [System.IO.Path]::GetFullPath($OutputDoc)
|
|
24
|
+
$MacroTemplate = [System.IO.Path]::GetFullPath($MacroTemplate)
|
|
25
|
+
|
|
26
|
+
# --- Word ------------------------------------------------------
|
|
27
|
+
|
|
28
|
+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8;
|
|
29
|
+
|
|
30
|
+
$word = New-Object -ComObject Word.Application
|
|
31
|
+
$word.Visible = $false
|
|
32
|
+
$word.DisplayAlerts = 0
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
# Подключаем глобальный шаблон
|
|
36
|
+
$word.AddIns.Add($MacroTemplate, $true)
|
|
37
|
+
|
|
38
|
+
$doc = $word.Documents.Open($InputDoc)
|
|
39
|
+
|
|
40
|
+
# --- Generating -------------------------------------------
|
|
41
|
+
Write-Host "[*1] Generating continued listings..."
|
|
42
|
+
$word.Run("AutoListingContinuation")
|
|
43
|
+
|
|
44
|
+
Write-Host "[*2] Generating continued tables..."
|
|
45
|
+
$word.Run("AutoTableContinuation")
|
|
46
|
+
|
|
47
|
+
# --- Saving -----------------------------------------------
|
|
48
|
+
$doc.SaveAs($OutputDoc, 16)
|
|
49
|
+
|
|
50
|
+
if ($RenderPDF) {
|
|
51
|
+
Write-Host "[*3] Render to PDF..."
|
|
52
|
+
$word.Run("RenderSegmentsToPDF")
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
$doc.Close($false)
|
|
56
|
+
Write-Host "Done: $OutputDoc"
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
$word.Quit()
|
|
60
|
+
[System.Runtime.InteropServices.Marshal]::ReleaseComObject($word) | Out-Null
|
|
61
|
+
}
|