Skip to content

Commit

Permalink
feat(styles): added flexible customization of indents in lists (#648)
Browse files Browse the repository at this point in the history
  • Loading branch information
makhnatkin authored Mar 3, 2025
1 parent 9dc8836 commit dd4d488
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ MIT
- `--yfm-color-border`
- `--yfm-color-accent`
- `--yfm-tab-size`
- `--yfm-text-block-margin-block`

**code**

Expand Down Expand Up @@ -138,3 +139,9 @@ MIT

- `--yfm-file-icon`
- `--yfm-file-icon-color`

**list**

- `--yfm-list-item-margin-block`
- `--yfm-list-text-margin-block`
- `--yfm-list-text-last-margin-block`
7 changes: 7 additions & 0 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ MIT
- `--yfm-color-border`
- `--yfm-color-accent`
- `--yfm-tab-size`
- `--yfm-text-block-margin-block`

**code**

Expand Down Expand Up @@ -138,3 +139,9 @@ MIT

- `--yfm-file-icon`
- `--yfm-file-icon-color`

**list**

- `--yfm-list-item-margin-block`
- `--yfm-list-text-margin-block`
- `--yfm-list-text-last-margin-block`
7 changes: 6 additions & 1 deletion playground/scripts/configs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ const configuredSassPlugin = sassPlugin({

const res = await postcss([
autoprefixer({cascade: false}),
postcssPresetEnv({stage: 0}),
postcssPresetEnv({
stage: 0,
features: {
'logical-properties-and-values': false,
},
}),
]).process(source, config);

return res.css;
Expand Down
7 changes: 6 additions & 1 deletion scripts/package-build-configs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ const plugins = [
async transform(source) {
const {css} = await postcss([
autoprefixer({cascade: false}),
postcssPresetEnv({stage: 0}),
postcssPresetEnv({
stage: 0,
features: {
'logical-properties-and-values': false,
},
}),
]).process(source, {from: undefined});

return css;
Expand Down
11 changes: 8 additions & 3 deletions src/scss/_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
dl,
table,
pre {
margin: 0 0 15px;
margin-block: var(--yfm-text-block-margin-block, 0 15px);
}

ul,
Expand Down Expand Up @@ -333,12 +333,17 @@
}

li + li {
margin-top: 0.33em;
margin-block: var(--yfm-list-item-margin-block, 0.33em 0);
}

li p,
li blockquote {
margin-top: 15px;
margin-block: var(--yfm-list-text-margin-block, 15px);
}

li > p:last-child,
li > blockquote:last-child {
margin-block: var(--yfm-list-text-last-margin-block, 15px);
}

code {
Expand Down

0 comments on commit dd4d488

Please sign in to comment.