-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,080 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/target | ||
node_modules/ | ||
pnpm-lock.yaml | ||
docs/book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[book] | ||
title = "Markup_fmt Documentation" | ||
authors = ["Pig Fang"] | ||
language = "en" | ||
|
||
[output.html] | ||
git-repository-url = "https://github.com/g-plane/markup_fmt" | ||
edit-url-template = "https://github.com/g-plane/markup_fmt/edit/main/docs/{path}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Summary | ||
|
||
- [Configuration](./config/README.md) | ||
- [printWidth](./config/print-width.md) | ||
- [useTabs](./config/use-tabs.md) | ||
- [indentWidth](./config/indent-width.md) | ||
- [lineBreak](./config/line-break.md) | ||
- [quotes](./config/quotes.md) | ||
- [formatComments](./config/format-comments.md) | ||
- [scriptIndent](./config/script-indent.md) | ||
- [styleIndent](./config/style-indent.md) | ||
- [closingBracketSameLine](./config/closing-bracket-same-line.md) | ||
- [closingTagLineBreakForEmpty](./config/closing-tag-line-break-for-empty.md) | ||
- [maxAttrsPerLine](./config/max-attrs-per-line.md) | ||
- [preferAttrsSingleLine](./config/prefer-attrs-single-line.md) | ||
- [*.selfClosing](./config/self-closing.md) | ||
- [whitespaceSensitivity](./config/whitespace-sensitivity.md) | ||
- [doctypeKeywordCase](./config/doctype-keyword-case.md) | ||
- [vBindStyle](./config/v-bind-style.md) | ||
- [vOnStyle](./config/v-on-style.md) | ||
- [vForDelimiterStyle](./config/v-for-delimiter-style.md) | ||
- [vSlotStyle](./config/v-slot-style.md) | ||
- [vBindSameNameShortHand](./config/v-bind-same-name-short-hand.md) | ||
- [strictSvelteAttr](./config/strict-svelte-attr.md) | ||
- [svelteAttrShorthand](./config/svelte-attr-shorthand.md) | ||
- [svelteDirectiveShorthand](./config/svelte-directive-shorthand.md) | ||
- [astroAttrShorthand](./config/astro-attr-shorthand.md) | ||
- [ignoreCommentDirective](./config/ignore-comment-directive.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Configuration | ||
|
||
Options name in this page are in camel case. If you're using markup_fmt as a Rust crate, please use snake case instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# `astroAttrShorthand` | ||
|
||
Control whether Astro attribute should be written in short-hand form or not when possible. | ||
If this option is unset, attribute won't be changed. | ||
|
||
Default value is `null`. | ||
|
||
## Example for `null` | ||
|
||
Input: | ||
|
||
```html | ||
<MyComponent {value} /> | ||
<MyComponent value={value} /> | ||
``` | ||
|
||
Output: | ||
|
||
```html | ||
<MyComponent {value} /> | ||
<MyComponent value={value} /> | ||
``` | ||
|
||
## Example for `true` | ||
|
||
Input: | ||
|
||
```html | ||
<MyComponent {value} /> | ||
<MyComponent value={value} /> | ||
``` | ||
|
||
Output: | ||
|
||
```html | ||
<MyComponent {value} /> | ||
<MyComponent {value} /> | ||
``` | ||
|
||
## Example for `false` | ||
|
||
Input: | ||
|
||
```html | ||
<MyComponent {value} /> | ||
<MyComponent value={value} /> | ||
``` | ||
|
||
Output: | ||
|
||
```html | ||
<MyComponent value={value} /> | ||
<MyComponent value={value} /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# `closingBracketSameLine` | ||
|
||
Control the closing bracket (`>`) of a multi-line element should come at the end of the last line | ||
or on the next line (with a line break). | ||
|
||
Default option is `false`. | ||
|
||
## Example for `false` | ||
|
||
```html | ||
<span | ||
class="" | ||
style="" | ||
></span> | ||
``` | ||
|
||
## Example for `true` | ||
|
||
```html | ||
<span | ||
class="" | ||
style=""></span> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# `closingTagLineBreakForEmpty` | ||
|
||
When there're no children in an element, | ||
this option controls whether to insert a line break before the closing tag or not. | ||
|
||
Possible options: | ||
|
||
- `"always"`: Always insert a line break before the closing tag. | ||
- `"fit"`: Only insert a line break if it doesn't fit the [`printWidth`](./print-width.md) option. | ||
- `"never"`: Don't insert a line break. | ||
|
||
Default option is `"fit"`. | ||
|
||
## Example for `"always"` | ||
|
||
```html | ||
<div> | ||
</div> | ||
<div class="very-very-very-very-very-very-very-very-very-long-class-name"> | ||
</div> | ||
``` | ||
|
||
## Example for `"fit"` | ||
|
||
```html | ||
<div></div> | ||
<div class="very-very-very-very-very-very-very-very-very-long-class-name"> | ||
</div> | ||
``` | ||
|
||
## Example for `"never"` | ||
|
||
```html | ||
<div></div> | ||
<div class="very-very-very-very-very-very-very-very-very-long-class-name"></div> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# `doctypeKeywordCase` | ||
|
||
Control the case of "doctype" keyword in `<!DOCTYPE>`. | ||
|
||
Possible options: | ||
|
||
- `"ignore"`: Keep the case as-is. | ||
- `"upper"`: Print "DOCTYPE" in upper case. | ||
- `"lower"`: Print "doctype" in lower case. | ||
|
||
Default option is `"upper"`. | ||
|
||
## Example for `"ignore"` | ||
|
||
Input: | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
``` | ||
|
||
Output: | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
``` | ||
|
||
## Example for `"upper"` | ||
|
||
Input: | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
``` | ||
|
||
Output: | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<!DOCTYPE html> | ||
``` | ||
|
||
## Example for `"lower"` | ||
|
||
Input: | ||
|
||
```html | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
``` | ||
|
||
Output: | ||
|
||
```html | ||
<!doctype html> | ||
<!doctype html> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# `formatComments` | ||
|
||
Control whether whitespace should be inserted at the beginning and end of comments and | ||
comments should be indented properly or not. | ||
|
||
When this option is set to `false`, comments contain leading or trailing whitespace will still be kept as-is. | ||
|
||
Default option is `false`. | ||
|
||
## Example for `false` | ||
|
||
```html | ||
<!--comments--> | ||
<!-- comments --> | ||
<!--very very very very very very very very very very very very very very very very long--> | ||
``` | ||
|
||
will be formatted as its original input. | ||
|
||
## Example for `true` | ||
|
||
```html | ||
<!-- comments --> | ||
<!-- comments --> | ||
<!-- | ||
very very very very very very very very very very very very very very very very long | ||
--> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# `ignoreCommentDirective` | ||
|
||
Text directive for ignoring formatting specific element or node. | ||
|
||
Default is `"markup-fmt-ignore"`. | ||
|
||
## Example | ||
|
||
```html | ||
<div></div> | ||
<!-- markup-fmt-ignore --> | ||
<div > </div> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# `indentWidth` | ||
|
||
Size of indentation. When enabled [`useTabs`](./use-tabs.md), this option may be disregarded, | ||
since only one tab will be inserted when indented once. | ||
|
||
Default option is `2`. This can't be zero. | ||
|
||
## Example for `2` | ||
|
||
```html | ||
<script | ||
src="very-very-very-very-long-name.js" | ||
async | ||
defer | ||
></script> | ||
``` | ||
|
||
## Example for `4` | ||
|
||
```html | ||
<script | ||
src="very-very-very-very-long-name.js" | ||
async | ||
defer | ||
></script> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# `lineBreak` | ||
|
||
Specify whether use `\n` (LF) or `\r\n` (CRLF) for line break. | ||
|
||
Default option is `"lf"`. Possible options are `"lf"` and `"crlf"`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# `maxAttrsPerLine` | ||
|
||
Control the maximum number of attributes in one line. | ||
If this option is unset, there won't be any limitations. | ||
|
||
This option conflicts with [`preferAttrsSingleLine`](./prefer-attrs-single-line.md) option. | ||
|
||
Default option is `null`. This option can't be `0`. | ||
|
||
## Example for `null` | ||
|
||
```html | ||
<div data-a data-b data-c></div> | ||
``` | ||
|
||
## Example for `1` | ||
|
||
```html | ||
<div | ||
data-a | ||
data-b | ||
data-c | ||
></div> | ||
``` | ||
|
||
## Example for `2` | ||
|
||
```html | ||
<div | ||
data-a data-b | ||
data-c | ||
></div> | ||
``` |
Oops, something went wrong.