Options name in this page are in camel case. If you're using Malva as a Rust crate, please use snake case instead.
The line width limitation that Malva should (but not must) avoid exceeding. Malva will try its best to keep line width less than this value, but it may exceed for some cases, for example, a very very long single word.
Default option is 80
.
a {
font: ultra-condensed small-caps 1.2em "Fira Sans", sans-serif;
}
a {
font:
ultra-condensed small-caps 1.2em
"Fira Sans",
sans-serif;
}
Specify use space or tab for indentation.
Default option is false
.
Size of indentation. When enabled useTabs
, this option may be disregarded,
since only one tab will be inserted when indented once.
Default option is 2
. This can't be zero.
Examples below will are based on useTabs: false
.
a {
text-decoration: none;
}
a {
text-decoration: none;
}
Specify use \n
(LF) or \r\n
(CRLF) for line break.
Default option is "lf"
. Possible options are "lf"
and "crlf"
.
Control the case of hex color values.
Possible options:
"lower"
: Hex color values will be converted to lower case."upper"
: Hex color values will be converted to upper case."ignore"
: Hex color values will be kept as-is.
Default option is "lower"
.
a {
background: #fff;
}
a {
background: #FFF;
}
a {
background: #FfF;
}
Control the hex color values in short-hand form or long-hand form.
Possible options:
null
: Hex color values will be kept as-is."short"
: Hex color values will be converted to short-hand form."long"
: Hex color values will be converted to long-hand form.
Default option is null
.
a {
color: #fff;
color: #ffffff;
}
a {
color: #fff;
}
a {
color: #ffffff;
}
Control the quotes of strings.
Possible options:
"alwaysDouble"
: Always use double quotes. Double quotes in strings will be escaped."alwaysSingle"
: Always use single quotes. Single quotes in strings will be escaped."preferDouble"
: Use double quotes as possible. However if there're double quotes in strings, quotes will be kept as-is."preferSingle"
: Use single quotes as possible. However if there're single quotes in strings, quotes will be kept as-is.
Default option is "alwaysDouble"
.
::before {
content: "";
content: "\"";
}
::before {
content: '';
content: '\'';
}
::before {
content: "";
content: '"';
}
::before {
content: '';
content: "'";
}
Control whether line break should come before or after operators.
Possible options:
"before"
: Line break will come before operators."after"
: Line break will come after operators.
Default option is "after"
.
a {
width: calc(
100%
- (
var(--sidebar-width) + var(--padding-horizontal) + var(--border-width)
+ var(--margin-horizontal)
+ var(--scrollbar-width)
)
);
}
a {
width: calc(
100% -
(
var(--sidebar-width) + var(--padding-horizontal) + var(--border-width) +
var(--margin-horizontal) +
var(--scrollbar-width)
)
);
}
Control line break behavior after selector commas.
Possible options:
"always"
: Always insert line break after comma."consistent"
: If the whole selector can be put on a single line, there won't be line breaks; otherwise, there will be line breaks after each comma."wrap"
: Selector will be put on one line as possible. Once it exceedsprintWidth
, line break will be inserted where the code exceedsprintWidth
.
Default option is "consistent"
.
h1,
h2,
h3,
h4,
h5,
h6 {}
In this example, the first selector can be put on one line, but the second selector can't, so there will be line breaks.
h1, h2, h3, h4, h5, h6 {}
.very-very-very-very-very-very-long-selector,
.very-very-very-very-very-very-very-very-very-long-selector {}
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote,
pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small,
strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label,
legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas,
details, figcaption, figure, footer, header, hgroup, menu, nav, section,
summary, time, mark, audio, video {}
Control whether omit leading zero before dot of numbers or not.
Default option is false
.
a {
width: 0.1px;
}
a {
width: .1px;
}
Control whether trailing comma should be inserted or not.
This only affects Sass list, Sass map, Sass parameters/arguments list, Less list and Less parameters/arguments list. CSS functions won't respect this option.
Default option is false
.
$config: (
themes: (
mist: (header: #dcfac0, content: #00968b, footer: #85c79c),
$spring: (header: #f4fac7, content: #c2454e, footer: #ffb158)
)
);
$config: (
themes: (
mist: (header: #dcfac0, content: #00968b, footer: #85c79c),
$spring: (header: #f4fac7, content: #c2454e, footer: #ffb158),
),
);
Control whether whitespace should be inserted at the beginning and end of comments.
Though this option is set to false
, comments contain leading or trailing whitespace will still be kept as-is.
Default option is false
.
/*comments*/
/* comments */
/* comments */
/* comments */
Control whether line break should be inserted in pseudo class/element parens or not if current line is too long.
Default option is false
.
:where(#p0:checked ~ #play:checked ~ #c1:checked, #p1:checked
~ #play:checked
~ #c2:checked, #p2:checked ~ #play:checked ~ #cO:checked) {}
:where(
#p0:checked ~ #play:checked ~ #c1:checked,
#p1:checked ~ #play:checked ~ #c2:checked,
#p2:checked ~ #play:checked ~ #cO:checked
) {}
Control the strategy of sorting CSS declarations (a.k.a. properties). If it's null
, it won't sort CSS declarations.
Here're the strategies:
alphabetical
: Order in a simple alphabetical manner from a - z. This strategy will also sort unknown properties.smacss
: Order from most important, flow affecting properties, to least important properties. Unknown properties won't be sorted.concentric
: Order properties applying outside the box model, moving inward to intrinsic changes. Unknown properties won't be sorted.
For more detail, please read https://github.com/Siilwyn/css-declaration-sorter.
Default option value is null
.
- For all strategies, custom properties (whose name starts with
--
) won't be sorted. - It will only sort adjacent CSS declarations. For example:
div {
width: 0;
height: 0;
span {}
min-width: 0;
min-height: 0;
}
Those declarations above the span {}
and those declarations below the span {}
will be sorted separately.
div {
display: flex;
height: 0;
width: 0;
}
div {
display: flex;
width: 0;
height: 0;
}
div {
display: flex;
width: 0;
height: 0;
}
Control the threshold value for putting block on a single line. If the number of statements in a block is less than or equal to this value, the block will be put on a single line as possible, but when the code can't fit on single line, it will still break into multiple lines.
This is especially useful for increasing readability when writing atomic CSS. For example:
.border-0 { border-width: 0px; }
.border-1 { border-width: 1px; }
.border-2 { border-width: 2px; }
.border-3 { border-width: 3px; }
.border-4 { border-width: 4px; }
.border-5 { border-width: 5px; }
Default option value is null
which means always break into multiple lines. The option value can be an integer which is greater than or equal to 0.
a {
/* comment */
}
a {
width: 0;
}
a { /* comment */ }
a { width: 0; }
a {
width: 0;
height: 0;
}
a { /* comment */ }
a { width: 0; }
a { width: 0; height: 0; }
Control whether to use percentage or keyword (from
and to
) notation as keyframe selectors.
Possible options:
null
: Keyframe selector notation will be kept as-is."keyword"
: Use keyword notation. This only affects0%
and100%
. For other percentage values, they will be kept as-is."percentage"
: Use percentage notation.
Default option is null
.
@keyframes foo {
from {}
50% {}
100% {}
}
@keyframes foo {
from {}
50% {}
to {}
}
@keyframes foo {
0% {}
50% {}
100% {}
}
Control whether should add quotes to attribute value in selector or not if it's not quoted.
Possible options:
"always"
: Always add quotes."ignore"
: Don't add quotes to those that're not quoted. For quoted value, quotes won't be removed.
Default option is "always"
.
[key="value"] {}
[key=value] {}
Text directive for ignoring formatting specific statement.
Default is "malva-ignore"
.
/* malva-ignore */
a,b{
width : 0;
}