sommark 1.1.0 → 1.1.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 +6 -0
- package/cli/cli.mjs +7 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -29,3 +29,9 @@
|
|
|
29
29
|
- **Transpiler**: `AtBlock` content is now **escaped by default** in the transpiler to prevent XSS.
|
|
30
30
|
- **Mapper**: Added `options` to `Mapper.create` (e.g., `{ escape: false }`) to allow specific blocks (like `Code`, `List`, `Table`) to opt-out of automatic escaping when they handle raw content safely or require it for parsing.
|
|
31
31
|
- **Parser**: Removed manual escaping from Parser to support the new transpiler-based architecture.
|
|
32
|
+
|
|
33
|
+
## 1.1.1 (2026-01-10)
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
- **CLI**: Fixed a bug where passing a Mapper object in `smark.config.js` (Custom Mode) caused a crash. The CLI now correctly handles both file path strings and imported Mapper objects.
|
package/cli/cli.mjs
CHANGED
|
@@ -113,10 +113,15 @@ async function loadConfig() {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
async function transpile({ src, format, mappingFile = "" }) {
|
|
116
|
+
if (typeof mappingFile === "object" && mappingFile !== null) {
|
|
117
|
+
return transpiler({ ast: parser(lexer(src)), format, mapperFile: mappingFile });
|
|
118
|
+
}
|
|
116
119
|
if ((await loadConfig()).mode === "default") {
|
|
117
120
|
return transpiler({ ast: parser(lexer(src)), format, mapperFile: format === "html" ? html : format === "md" ? md : mdx });
|
|
118
|
-
} else if (mappingFile && isExist(mappingFile)) {
|
|
119
|
-
|
|
121
|
+
} else if (typeof mappingFile === "string" && (await isExist(mappingFile))) {
|
|
122
|
+
const mappingFileURL = pathToFileURL(path.resolve(process.cwd(), mappingFile)).href;
|
|
123
|
+
const loadedMapper = await import(mappingFileURL);
|
|
124
|
+
return transpiler({ ast: parser(lexer(src)), format, mapperFile: loadedMapper.default });
|
|
120
125
|
} else {
|
|
121
126
|
cliError([`{line}<$red:File$> <$blue:'${mappingFile}'$> <$red: is not found$>{line}`]);
|
|
122
127
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sommark",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
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": {
|