@inshapardaz/likhari-converters 0.1.31 → 0.1.32-dev.273
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/markdown/parse.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/markdown/parse.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAkUjD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,qBAAqB,CAO3F"}
|
package/dist/markdown/parse.js
CHANGED
|
@@ -16,7 +16,8 @@ const DIRECTIVE_FORMATS = {
|
|
|
16
16
|
/** Inverse of the serializer's `styleToAttrs`. */
|
|
17
17
|
function attrsToStyle(attrs) {
|
|
18
18
|
const parts = [];
|
|
19
|
-
|
|
19
|
+
// 'font'/'size' are not mapped: Markdown stays close to plain GFM, without a font choice (serialize.ts).
|
|
20
|
+
const map = [['color', 'color'], ['bg', 'background-color']];
|
|
20
21
|
for (const [attr, prop] of map) {
|
|
21
22
|
const value = attrs[attr];
|
|
22
23
|
// A value that could break out of the declaration is dropped.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/markdown/serialize.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAKjD,OAAO,EAAa,KAAK,KAAK,EAAe,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/markdown/serialize.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAKjD,OAAO,EAAa,KAAK,KAAK,EAAe,MAAM,SAAS,CAAC;AA6C7D,2GAA2G;AAC3G,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAWjD;AAqHD,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAMhE;AAuJD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,EAAE,GAAG,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAM9F"}
|
|
@@ -20,11 +20,12 @@ const FORMAT_WRAPPERS = [
|
|
|
20
20
|
[FORMAT_HIGHLIGHT, { key: 'mark', wrap: (c) => directive('textDirective', 'mark', {}, c) }],
|
|
21
21
|
];
|
|
22
22
|
const STYLE_ATTRS = [
|
|
23
|
-
['font-family', 'font'],
|
|
24
|
-
['font-size', 'size'],
|
|
25
23
|
['color', 'color'],
|
|
26
24
|
['background-color', 'bg'],
|
|
27
25
|
];
|
|
26
|
+
// Dropped rather than kept in `style`: Markdown stays close to plain GFM, and
|
|
27
|
+
// a font choice is rarely meaningful once the document leaves the editor.
|
|
28
|
+
const DROPPED_STYLE_PROPS = new Set(['font-family', 'font-size']);
|
|
28
29
|
function parseStyle(style) {
|
|
29
30
|
return style
|
|
30
31
|
.split(';')
|
|
@@ -41,6 +42,8 @@ export function styleToAttrs(style) {
|
|
|
41
42
|
const attrs = {};
|
|
42
43
|
const rest = [];
|
|
43
44
|
for (const [prop, value] of parseStyle(style)) {
|
|
45
|
+
if (DROPPED_STYLE_PROPS.has(prop))
|
|
46
|
+
continue;
|
|
44
47
|
const mapped = STYLE_ATTRS.find(([p]) => p === prop);
|
|
45
48
|
if (mapped)
|
|
46
49
|
attrs[mapped[1]] = value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inshapardaz/likhari-converters",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32-dev.273",
|
|
4
4
|
"description": "Format transformers (Markdown/HTML/plain-text/Lexical JSON) against the canonical Lexical EditorState, isolated from UI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|