prettier-plugin-mmd 0.6.0 → 0.7.0
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.ja.md +15 -2
- package/README.md +13 -4
- package/lib/index.d.mts +6 -2
- package/lib/index.mjs +1026 -117
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -17,7 +17,7 @@ MultiMarkdown や MikuMikuDance ではありません。
|
|
|
17
17
|
## Playground
|
|
18
18
|
|
|
19
19
|
ブラウザーで、このプラグインによる整形結果を確認できます。
|
|
20
|
-
**Formatted
|
|
20
|
+
**Formatted**タブは編集に合わせて更新され、**Print width**で行幅を、
|
|
21
21
|
**Indent**と**Use tabs**で字下げを設定できます。
|
|
22
22
|
**Apply to source**で、入力を整形結果に置き換えられます。
|
|
23
23
|
|
|
@@ -110,7 +110,20 @@ flowchart LR
|
|
|
110
110
|
- `useTabs` と `tabWidth` で字下げを決めます。
|
|
111
111
|
既定は空白 2 つです。
|
|
112
112
|
- `endOfLine` で改行コードを決めます。
|
|
113
|
-
- `printWidth`
|
|
113
|
+
- `printWidth` は 2 つのことを決めます。
|
|
114
|
+
flowchart、agentflow、kanban で 1 行に書いたデータブロック `@{ … }` は、
|
|
115
|
+
その行が `printWidth` より広く、条件を満たすときに、複数行で印字します。
|
|
116
|
+
たとえば、項目が 1 つのブロックは 1 行のままです。
|
|
117
|
+
条件は、
|
|
118
|
+
[データブロック](./docs/flowchart.ja.md#データブロック)を参照してください。
|
|
119
|
+
Gantt のセクションのタスクの `:` は、行が `printWidth` より広くなり、
|
|
120
|
+
しかも今より広くなるときを除いて、そろえます。
|
|
121
|
+
詳しくは、
|
|
122
|
+
[タスクのデータ](./docs/gantt.ja.md#タスクのデータ)を参照してください。
|
|
123
|
+
幅は Prettier が測る幅で、全角文字は 2 桁、タブは 0 桁と数えます。
|
|
124
|
+
Gantt のセクションは、Markdown のリストや引用が行の前に置くものを数えず、
|
|
125
|
+
行だけの幅で数えます。
|
|
126
|
+
それ以外では、`printWidth` は図の改行位置を決めません。
|
|
114
127
|
`railroad-beta` の呼び出しは文法の構造に従います。
|
|
115
128
|
詳細は[長い行](./docs/railroad.ja.md#長い行)を参照してください。
|
|
116
129
|
Markdown と YAML frontmatter には、Prettier が使う場合があります。
|
package/README.md
CHANGED
|
@@ -16,8 +16,8 @@ Documentation:
|
|
|
16
16
|
## Playground
|
|
17
17
|
|
|
18
18
|
Preview this plugin's formatting in the browser. The **Formatted** tab updates
|
|
19
|
-
as you edit, with **Indent
|
|
20
|
-
to replace the input with the result.
|
|
19
|
+
as you edit, with **Print width**, **Indent**, and **Use tabs** controls. Use
|
|
20
|
+
**Apply to source** to replace the input with the result.
|
|
21
21
|
|
|
22
22
|
Open the [Playground](https://mmd-toolkit.github.io/mmd-toolkit/playground/).
|
|
23
23
|
|
|
@@ -102,8 +102,17 @@ The formatting rules of each diagram type are in its document:
|
|
|
102
102
|
|
|
103
103
|
- `useTabs` and `tabWidth` set the indentation. The default is two spaces.
|
|
104
104
|
- `endOfLine` sets the line endings.
|
|
105
|
-
- `printWidth`
|
|
106
|
-
|
|
105
|
+
- `printWidth` decides two things. A data block `@{ … }` on one line in a
|
|
106
|
+
flowchart, an agentflow, or a kanban board is printed on several lines when
|
|
107
|
+
its line is wider than `printWidth` and the conditions of
|
|
108
|
+
[Data blocks](./docs/flowchart.md#data-blocks) hold; a block of one entry, for
|
|
109
|
+
example, stays on its line. The colons of the tasks of a Gantt section are
|
|
110
|
+
lined up unless that would make a line wider than `printWidth` and wider than
|
|
111
|
+
it is (see [Task data](./docs/gantt.md#task-data)). The width is the one
|
|
112
|
+
Prettier measures: a full-width character counts as two columns and a tab as
|
|
113
|
+
none. A Gantt section counts its lines alone, without what a Markdown list or
|
|
114
|
+
block quote puts before them. Everywhere else `printWidth` does not control
|
|
115
|
+
diagram line breaks. `railroad-beta` calls follow their grammar structure; see
|
|
107
116
|
[Long lines](./docs/railroad.md#long-lines). Prettier can still use it for
|
|
108
117
|
Markdown and YAML frontmatter.
|
|
109
118
|
|
package/lib/index.d.mts
CHANGED
|
@@ -165,8 +165,12 @@ type MermaidAst = FormattedDocument | Node;
|
|
|
165
165
|
//#endregion
|
|
166
166
|
//#region src/index.d.ts
|
|
167
167
|
export declare const languages: SupportLanguage[];
|
|
168
|
-
export declare const parsers:
|
|
169
|
-
|
|
168
|
+
export declare const parsers: {
|
|
169
|
+
mermaid: Parser<MermaidAst>;
|
|
170
|
+
};
|
|
171
|
+
export declare const printers: {
|
|
172
|
+
mermaid: Printer<MermaidAst>;
|
|
173
|
+
};
|
|
170
174
|
declare const plugin: Plugin<MermaidAst>;
|
|
171
175
|
//#endregion
|
|
172
176
|
export { type FormattedDocument, type MermaidAst, plugin as default };
|