@soroush.tech/markdown 1.2.2 → 1.2.3-rc.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/README.md +3 -3
- package/dist/{Toolbar-CRlLqvj9.cjs → Toolbar-BlMahuVU.cjs} +18 -10
- package/dist/{Toolbar-BoEuAIiw.mjs → Toolbar-zDEkBuqy.mjs} +18 -10
- package/dist/Toolbar.cjs +1 -1
- package/dist/Toolbar.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@soroush.tech/markdown)
|
|
2
2
|
[](https://www.npmjs.com/package/@soroush.tech/markdown)
|
|
3
|
-
[](https://app.codecov.io/gh/soroush-tech/design-system?flags%5B0%5D=markdown)
|
|
4
4
|
[](https://www.npmjs.com/package/@soroush.tech/markdown)
|
|
5
5
|
[](https://www.npmjs.com/package/@soroush.tech/markdown)
|
|
6
6
|
[](./LICENSE)
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
Compose a toolbar, a source editor, and a live preview however your UI needs - and every element is styled by your theme. The renderer works standalone too, turning any markdown string into themed components, with support for tables, task lists, strikethrough, autolinks, syntax-highlighted code, and mermaid diagrams.
|
|
11
11
|
|
|
12
|
-

|
|
13
13
|
|
|
14
14
|
## Why headless?
|
|
15
15
|
|
|
@@ -128,7 +128,7 @@ There is intentionally **no Edit·Split·Preview switch** - which panes to show,
|
|
|
128
128
|
| `Editor` | The source `<textarea>` - Tab-to-indent, selection, caret restore. |
|
|
129
129
|
| `Preview` | Renders a markdown string (its child) to themed components. |
|
|
130
130
|
|
|
131
|
-
`Toolbar` and `Editor` must be rendered inside `Control`; `Preview` works anywhere. Import each directly from the package - there is no `Markdown.*` namespace. Full prop references live in the [source on GitHub](https://github.com/soroush-tech/
|
|
131
|
+
`Toolbar` and `Editor` must be rendered inside `Control`; `Preview` works anywhere. Import each directly from the package - there is no `Markdown.*` namespace. Full prop references live in the [source on GitHub](https://github.com/soroush-tech/design-system/tree/main/packages/markdown/src).
|
|
132
132
|
|
|
133
133
|
## Customizing the look
|
|
134
134
|
|
|
@@ -5,7 +5,8 @@ let _soroush_tech_design_system_Button = require("@soroush.tech/design-system/Bu
|
|
|
5
5
|
let _soroush_tech_design_system_ButtonGroup = require("@soroush.tech/design-system/ButtonGroup");
|
|
6
6
|
let _soroush_tech_design_system_Flex = require("@soroush.tech/design-system/Flex");
|
|
7
7
|
let _soroush_tech_design_system_Icon = require("@soroush.tech/design-system/Icon");
|
|
8
|
-
let
|
|
8
|
+
let _soroush_tech_design_system_MenuItem = require("@soroush.tech/design-system/MenuItem");
|
|
9
|
+
let _soroush_tech_design_system_Select = require("@soroush.tech/design-system/Select");
|
|
9
10
|
let _soroush_tech_design_system_Typography = require("@soroush.tech/design-system/Typography");
|
|
10
11
|
let _soroush_tech_design_system = require("@soroush.tech/design-system");
|
|
11
12
|
let _soroush_tech_design_system_theme = require("@soroush.tech/design-system/theme");
|
|
@@ -481,6 +482,10 @@ const DIAGRAM_OPTIONS = MERMAID_DIAGRAMS.map((diagram) => ({
|
|
|
481
482
|
value: diagram.value
|
|
482
483
|
}));
|
|
483
484
|
const DIAGRAM_SNIPPET_BY_VALUE = Object.fromEntries(MERMAID_DIAGRAMS.map((diagram) => [diagram.value, diagram.snippet]));
|
|
485
|
+
const menuItems = (options) => options.map(({ label, value }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_soroush_tech_design_system_MenuItem.MenuItem, {
|
|
486
|
+
value,
|
|
487
|
+
children: label
|
|
488
|
+
}, value));
|
|
484
489
|
const HEADING_BY_ID = Object.fromEntries(HEADING_ACTIONS.map((action) => [action.id, action]));
|
|
485
490
|
const ToolbarRoot = (0, _soroush_tech_design_system.styled)(_soroush_tech_design_system_Flex.Flex, {
|
|
486
491
|
name: "MarkdownToolbar",
|
|
@@ -534,14 +539,15 @@ function Toolbar() {
|
|
|
534
539
|
role: "toolbar",
|
|
535
540
|
"aria-label": "Markdown formatting",
|
|
536
541
|
children: [
|
|
537
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
542
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_soroush_tech_design_system_Select.Select, {
|
|
543
|
+
native: true,
|
|
538
544
|
size: "sm",
|
|
539
545
|
variant: "outlined",
|
|
540
546
|
placeholder: "Heading",
|
|
541
547
|
value: "",
|
|
542
|
-
options: HEADING_OPTIONS,
|
|
543
548
|
onChange: (value) => dispatch(HEADING_BY_ID[String(value)]),
|
|
544
|
-
|
|
549
|
+
"aria-label": "Heading level",
|
|
550
|
+
children: menuItems(HEADING_OPTIONS)
|
|
545
551
|
}),
|
|
546
552
|
groupToolbarActions(TOOLBAR_ACTIONS).map((segment) => segment.length > 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_soroush_tech_design_system_ButtonGroup.ButtonGroup, {
|
|
547
553
|
borderRadius: "sq",
|
|
@@ -562,23 +568,25 @@ function Toolbar() {
|
|
|
562
568
|
alignItems: "stretch",
|
|
563
569
|
children: [
|
|
564
570
|
renderButton(INLINE_CODE_ACTION),
|
|
565
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
571
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_soroush_tech_design_system_Select.Select, {
|
|
572
|
+
native: true,
|
|
566
573
|
size: "sm",
|
|
567
574
|
variant: "outlined",
|
|
568
575
|
placeholder: "Code",
|
|
569
576
|
value: "",
|
|
570
|
-
options: CODE_LANGUAGES,
|
|
571
577
|
onChange: (value) => dispatch(codeBlockAction(String(value))),
|
|
572
|
-
|
|
578
|
+
"aria-label": "Code block language",
|
|
579
|
+
children: menuItems(CODE_LANGUAGES)
|
|
573
580
|
}),
|
|
574
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
581
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_soroush_tech_design_system_Select.Select, {
|
|
582
|
+
native: true,
|
|
575
583
|
size: "sm",
|
|
576
584
|
variant: "outlined",
|
|
577
585
|
placeholder: "Diagram",
|
|
578
586
|
value: "",
|
|
579
|
-
options: DIAGRAM_OPTIONS,
|
|
580
587
|
onChange: (value) => dispatch(mermaidDiagramAction(DIAGRAM_SNIPPET_BY_VALUE[String(value)])),
|
|
581
|
-
|
|
588
|
+
"aria-label": "Mermaid diagram type",
|
|
589
|
+
children: menuItems(DIAGRAM_OPTIONS)
|
|
582
590
|
})
|
|
583
591
|
]
|
|
584
592
|
})
|
|
@@ -5,7 +5,8 @@ import { Button } from "@soroush.tech/design-system/Button";
|
|
|
5
5
|
import { ButtonGroup } from "@soroush.tech/design-system/ButtonGroup";
|
|
6
6
|
import { Flex } from "@soroush.tech/design-system/Flex";
|
|
7
7
|
import { Icon } from "@soroush.tech/design-system/Icon";
|
|
8
|
-
import {
|
|
8
|
+
import { MenuItem } from "@soroush.tech/design-system/MenuItem";
|
|
9
|
+
import { Select } from "@soroush.tech/design-system/Select";
|
|
9
10
|
import { Typography } from "@soroush.tech/design-system/Typography";
|
|
10
11
|
import { styled } from "@soroush.tech/design-system";
|
|
11
12
|
import { themeDefault } from "@soroush.tech/design-system/theme";
|
|
@@ -481,6 +482,10 @@ const DIAGRAM_OPTIONS = MERMAID_DIAGRAMS.map((diagram) => ({
|
|
|
481
482
|
value: diagram.value
|
|
482
483
|
}));
|
|
483
484
|
const DIAGRAM_SNIPPET_BY_VALUE = Object.fromEntries(MERMAID_DIAGRAMS.map((diagram) => [diagram.value, diagram.snippet]));
|
|
485
|
+
const menuItems = (options) => options.map(({ label, value }) => /* @__PURE__ */ jsx(MenuItem, {
|
|
486
|
+
value,
|
|
487
|
+
children: label
|
|
488
|
+
}, value));
|
|
484
489
|
const HEADING_BY_ID = Object.fromEntries(HEADING_ACTIONS.map((action) => [action.id, action]));
|
|
485
490
|
const ToolbarRoot = styled(Flex, {
|
|
486
491
|
name: "MarkdownToolbar",
|
|
@@ -534,14 +539,15 @@ function Toolbar() {
|
|
|
534
539
|
role: "toolbar",
|
|
535
540
|
"aria-label": "Markdown formatting",
|
|
536
541
|
children: [
|
|
537
|
-
/* @__PURE__ */ jsx(
|
|
542
|
+
/* @__PURE__ */ jsx(Select, {
|
|
543
|
+
native: true,
|
|
538
544
|
size: "sm",
|
|
539
545
|
variant: "outlined",
|
|
540
546
|
placeholder: "Heading",
|
|
541
547
|
value: "",
|
|
542
|
-
options: HEADING_OPTIONS,
|
|
543
548
|
onChange: (value) => dispatch(HEADING_BY_ID[String(value)]),
|
|
544
|
-
|
|
549
|
+
"aria-label": "Heading level",
|
|
550
|
+
children: menuItems(HEADING_OPTIONS)
|
|
545
551
|
}),
|
|
546
552
|
groupToolbarActions(TOOLBAR_ACTIONS).map((segment) => segment.length > 1 ? /* @__PURE__ */ jsx(ButtonGroup, {
|
|
547
553
|
borderRadius: "sq",
|
|
@@ -562,23 +568,25 @@ function Toolbar() {
|
|
|
562
568
|
alignItems: "stretch",
|
|
563
569
|
children: [
|
|
564
570
|
renderButton(INLINE_CODE_ACTION),
|
|
565
|
-
/* @__PURE__ */ jsx(
|
|
571
|
+
/* @__PURE__ */ jsx(Select, {
|
|
572
|
+
native: true,
|
|
566
573
|
size: "sm",
|
|
567
574
|
variant: "outlined",
|
|
568
575
|
placeholder: "Code",
|
|
569
576
|
value: "",
|
|
570
|
-
options: CODE_LANGUAGES,
|
|
571
577
|
onChange: (value) => dispatch(codeBlockAction(String(value))),
|
|
572
|
-
|
|
578
|
+
"aria-label": "Code block language",
|
|
579
|
+
children: menuItems(CODE_LANGUAGES)
|
|
573
580
|
}),
|
|
574
|
-
/* @__PURE__ */ jsx(
|
|
581
|
+
/* @__PURE__ */ jsx(Select, {
|
|
582
|
+
native: true,
|
|
575
583
|
size: "sm",
|
|
576
584
|
variant: "outlined",
|
|
577
585
|
placeholder: "Diagram",
|
|
578
586
|
value: "",
|
|
579
|
-
options: DIAGRAM_OPTIONS,
|
|
580
587
|
onChange: (value) => dispatch(mermaidDiagramAction(DIAGRAM_SNIPPET_BY_VALUE[String(value)])),
|
|
581
|
-
|
|
588
|
+
"aria-label": "Mermaid diagram type",
|
|
589
|
+
children: menuItems(DIAGRAM_OPTIONS)
|
|
582
590
|
})
|
|
583
591
|
]
|
|
584
592
|
})
|
package/dist/Toolbar.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_Toolbar = require("./Toolbar-
|
|
2
|
+
const require_Toolbar = require("./Toolbar-BlMahuVU.cjs");
|
|
3
3
|
exports.TablePicker = require_Toolbar.TablePicker;
|
|
4
4
|
exports.Toolbar = require_Toolbar.Toolbar;
|
package/dist/Toolbar.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as TablePicker, t as Toolbar } from "./Toolbar-
|
|
1
|
+
import { n as TablePicker, t as Toolbar } from "./Toolbar-zDEkBuqy.mjs";
|
|
2
2
|
export { TablePicker, Toolbar };
|
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_Preview = require("./Preview-CnMWUtU2.cjs");
|
|
3
3
|
const require_MarkdownContext = require("./MarkdownContext.cjs");
|
|
4
4
|
const require_Control = require("./Control.cjs");
|
|
5
|
-
const require_Toolbar = require("./Toolbar-
|
|
5
|
+
const require_Toolbar = require("./Toolbar-BlMahuVU.cjs");
|
|
6
6
|
const require_Editor = require("./Editor.cjs");
|
|
7
7
|
const require_CodeBlock = require("./CodeBlock-Cymx1ZAY.cjs");
|
|
8
8
|
const require_Mermaid = require("./Mermaid-CkUan4z-.cjs");
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MarkdownContext, useMarkdownContext } from "./MarkdownContext.mjs";
|
|
2
2
|
import { Control } from "./Control.mjs";
|
|
3
|
-
import { n as TablePicker, t as Toolbar } from "./Toolbar-
|
|
3
|
+
import { n as TablePicker, t as Toolbar } from "./Toolbar-zDEkBuqy.mjs";
|
|
4
4
|
import { Editor } from "./Editor.mjs";
|
|
5
5
|
import { n as syntaxLight, r as CodeBlock, t as syntaxDark } from "./CodeBlock-CVlrvVPP.mjs";
|
|
6
6
|
import { t as Mermaid } from "./Mermaid-B7vDwGQG.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soroush.tech/markdown",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3-rc.1",
|
|
4
4
|
"description": "Headless, composable markdown editor + renderer for @soroush.tech/design-system - Control, Toolbar, Editor, and Preview built on react-markdown, remark-gfm, and rehype-highlight.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
],
|
|
15
15
|
"author": "Masoud Soroush <masoud@soroush.tech>",
|
|
16
16
|
"license": "MIT",
|
|
17
|
-
"homepage": "https://soroush.tech",
|
|
17
|
+
"homepage": "https://soroush.tech/markdown",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/soroush-tech/
|
|
20
|
+
"url": "git+https://github.com/soroush-tech/design-system.git",
|
|
21
21
|
"directory": "packages/markdown"
|
|
22
22
|
},
|
|
23
23
|
"bugs": {
|
|
24
|
-
"url": "https://github.com/soroush-tech/
|
|
24
|
+
"url": "https://github.com/soroush-tech/design-system/issues"
|
|
25
25
|
},
|
|
26
26
|
"type": "module",
|
|
27
27
|
"sideEffects": false,
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"unified": "^11.0.5"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
+
"@soroush.tech/design-system": "^1.3.3 || ^2.0.0-alpha.0",
|
|
68
69
|
"react": "^19.2.8",
|
|
69
|
-
"react-dom": "^19.2.8"
|
|
70
|
-
"@soroush.tech/design-system": "^1.3.3"
|
|
70
|
+
"react-dom": "^19.2.8"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@storybook/react-vite": "^10.5.8",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"tsdown": "^0.22.14",
|
|
86
86
|
"typescript": "~7.0.2",
|
|
87
87
|
"vitest": "^4.1.10",
|
|
88
|
-
"@soroush.tech/design-system": "
|
|
88
|
+
"@soroush.tech/design-system": "2.0.0-rc.1",
|
|
89
89
|
"@soroush.tech/eslint-config": "0.0.0",
|
|
90
90
|
"@soroush.tech/hooks": "0.1.0"
|
|
91
91
|
},
|