sommark 2.0.1 → 2.0.2
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 +12 -0
- package/README.md +3 -2
- package/cli/commands/help.js +5 -5
- package/core/formats.js +1 -0
- package/index.js +17 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v2.0.2 (2026-02-03)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
- **Exports**: Exposed `TOKEN_TYPES` and `labels` from core for advanced usage.
|
|
7
|
+
|
|
8
|
+
### Refactoring
|
|
9
|
+
- **Config**: Removed unused `custom_html` import from `smark.config.js`.
|
|
10
|
+
|
|
11
|
+
### Fixes
|
|
12
|
+
- **CLI**: Fixed typo in help message.
|
|
13
|
+
- **Cleanup**: Cleaned up `.npmignore`.
|
|
14
|
+
|
|
3
15
|
## v2.0.1 (2026-02-02)
|
|
4
16
|
|
|
5
17
|
### Refactoring
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<img src="https://img.shields.io/badge/mdx-supported-lightblue?style=flat-square" />
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
|
-
# SomMark v2
|
|
16
|
+
# SomMark v2
|
|
17
17
|
|
|
18
18
|
> [!WARNING]
|
|
19
19
|
> Old version is no longer supported.
|
|
@@ -151,7 +151,8 @@ Detailed guides and API references are available in the `docs/` directory:
|
|
|
151
151
|
* **[Core API](docs/core.md)**: Programmatic usage of the library (`transpile`, `lex`, `parse`).
|
|
152
152
|
* **[Mapper API](docs/mapper.md)**: Guide for creating custom mappers and rules.
|
|
153
153
|
* **[CLI Reference](docs/cli.md)**: Command line options and configurations.
|
|
154
|
-
* **[API Quick Reference](docs/api
|
|
154
|
+
* **[API Quick Reference](docs/api)**: Fast lookup for all classes and functions.
|
|
155
|
+
* **[Configuration Reference](docs/config.md)**: Guide for creating custom configurations.
|
|
155
156
|
|
|
156
157
|
|
|
157
158
|
|
package/cli/commands/help.js
CHANGED
|
@@ -8,14 +8,14 @@ import { options } from "../constants.js";
|
|
|
8
8
|
export function getHelp(unknown_option = true) {
|
|
9
9
|
const msg = [
|
|
10
10
|
`${unknown_option && process.argv[2] ? `<$red:Unrecognized option$> <$blue: '${process.argv[2]}'$>` : ""}`,
|
|
11
|
-
"{N}<$yellow:Usage:$> <$blue:
|
|
11
|
+
"{N}<$yellow:Usage:$> <$blue:sommark [option]$>",
|
|
12
12
|
|
|
13
13
|
"{N}{N}<$yellow:Global Options:$>",
|
|
14
14
|
"{N} <$green:-h, --help$> <$cyan: Show help message$>",
|
|
15
15
|
"{N} <$green:-v, --version$> <$cyan: Show version information$>",
|
|
16
16
|
|
|
17
17
|
"{N}{N}<$yellow:Transpilation Options:$>",
|
|
18
|
-
"{N}<$yellow:Usage:$> <$blue:
|
|
18
|
+
"{N}<$yellow:Usage:$> <$blue:sommark [option] [targetFile] [option] [outputFile] [outputDir]$>",
|
|
19
19
|
"{N} <$green:--html$> <$cyan: Transpile to HTML$>",
|
|
20
20
|
"{N} <$green:--markdown$> <$cyan: Transpile to Markdown$>",
|
|
21
21
|
"{N} <$green:--mdx$> <$cyan: Transpile to MDX$>",
|
|
@@ -26,9 +26,9 @@ export function getHelp(unknown_option = true) {
|
|
|
26
26
|
"{N} <$green:-o$> <$cyan: Specify output filename (and optionally directory)$>",
|
|
27
27
|
|
|
28
28
|
"{N}{N}<$yellow:Examples:$>",
|
|
29
|
-
"{N} <$magenta:1. Basic usage:$> <$blue:
|
|
30
|
-
"{N} <$magenta:2. Print to console:$> <$blue:
|
|
31
|
-
"{N} <$magenta:3. Custom output:$> <$blue:
|
|
29
|
+
"{N} <$magenta:1. Basic usage:$> <$blue:sommark --html input.smark$>",
|
|
30
|
+
"{N} <$magenta:2. Print to console:$> <$blue:sommark --html -p input.smark$>",
|
|
31
|
+
"{N} <$magenta:3. Custom output:$> <$blue:sommark --html input.smark -o myOutput ./dist/$>"
|
|
32
32
|
].join("");
|
|
33
33
|
const help_msg = formatMessage(msg);
|
|
34
34
|
|
package/core/formats.js
CHANGED
package/index.js
CHANGED
|
@@ -8,8 +8,9 @@ import MDX from "./mappers/languages/mdx.js";
|
|
|
8
8
|
import TagBuilder from "./formatter/tag.js";
|
|
9
9
|
import MarkdownBuilder from "./formatter/mark.js";
|
|
10
10
|
import { runtimeError } from "./core/errors.js";
|
|
11
|
-
import { textFormat, htmlFormat, markdownFormat, mdxFormat } from "./core/formats.js";
|
|
12
|
-
|
|
11
|
+
import FORMATS, { textFormat, htmlFormat, markdownFormat, mdxFormat } from "./core/formats.js";
|
|
12
|
+
import TOKEN_TYPES from "./core/tokenTypes.js";
|
|
13
|
+
import * as labels from "./core/labels.js";
|
|
13
14
|
class SomMark {
|
|
14
15
|
constructor({ src, format, mapperFile = null, includeDocument = true }) {
|
|
15
16
|
this.src = src;
|
|
@@ -91,5 +92,18 @@ async function transpile(options = {}) {
|
|
|
91
92
|
return await transpiler({ ast, format, mapperFile, includeDocument });
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
export {
|
|
95
|
+
export {
|
|
96
|
+
HTML,
|
|
97
|
+
MARKDOWN,
|
|
98
|
+
MDX,
|
|
99
|
+
Mapper,
|
|
100
|
+
TagBuilder,
|
|
101
|
+
MarkdownBuilder,
|
|
102
|
+
FORMATS,
|
|
103
|
+
lex,
|
|
104
|
+
parse,
|
|
105
|
+
transpile,
|
|
106
|
+
TOKEN_TYPES,
|
|
107
|
+
labels
|
|
108
|
+
};
|
|
95
109
|
export default SomMark;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sommark",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "SomMark is a structural markup language for writing structured documents and converting them into HTML or Markdown or MDX(only ready components).",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"directories": {
|