Skip to content

Commit 9059b84

Browse files
authored
fix(styles): added spacing rules to prevent jumps when editing lists (#751)
1 parent 1dd30c8 commit 9059b84

File tree

8 files changed

+171
-12
lines changed

8 files changed

+171
-12
lines changed

demo/stories/markdown/markup.ts

Lines changed: 153 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,123 @@ ___
6060
6161
## Lists
6262
63-
Unordered
63+
1. This is an ordered list.
64+
1. Every item has a numbered marker associated with it.
65+
66+
---
67+
68+
1. This is an ordered list.
69+
70+
1. Every item has a numbered marker associated with it.
71+
72+
---
73+
74+
1. This is an ordered list.
75+
1.
76+
1. Every item has a numbered marker associated with it.
77+
78+
---
79+
80+
* This is an unordered list.
81+
* List item markers of unordered lists are usually a dot or a dash.
82+
83+
---
84+
85+
1. This is an ordered list.
86+
This is an indented line inside the list item.
87+
1. Every item has a numbered marker associated with it.
88+
1. Every item has a numbered marker associated with it.
89+
90+
---
91+
92+
1. This is an ordered list.
93+
This is an indented line inside the list item.
94+
And one more.
95+
1. Every item has a numbered marker associated with it.
96+
1. Every item has a numbered marker associated with it.
97+
98+
---
99+
100+
1. This is an ordered list.
101+
This is an indented paragraph inside the list item.
102+
103+
1. Every item has a numbered marker associated with it.
104+
1. Every item has a numbered marker associated with it.
105+
106+
---
107+
108+
1. This is an ordered list.
109+
This is an indented paragraph inside the list item.
110+
111+
This is an second paragraph inside the list item.
112+
113+
1. Every item has a numbered marker associated with it.
114+
1. Every item has a numbered marker associated with it.
115+
116+
---
117+
118+
1. This ordered list will be nested.
119+
2. This item has additional sub-items.
120+
1. Like this one
121+
2. And this one
122+
3. And this as well.
123+
3. Futher numbering on top-level continues where we left off.
124+
125+
---
126+
127+
1. This ordered list will be nested.
128+
2. This item has additional sub-items.
129+
1. Like this one
130+
This is an indented paragraph inside the nested list item.
131+
132+
2. And this one
133+
3. And this as well.
134+
3. Futher numbering on top-level continues where we left off.
135+
136+
---
137+
138+
1. This ordered list will be nested.
139+
2. This item has additional sub-items.
140+
- Like this one
141+
- And this one
142+
143+
This paragraph between
144+
145+
1. Like this one
146+
1. And this one
147+
148+
3. Futher numbering on top-level continues where we left off.
149+
150+
---
151+
152+
1. In this example, every list item in the source begins with a 1.
153+
1. More items
154+
1. A sublist
155+
1. 2nd sublist item
156+
7. This one begins with a 7. (Check the controls tab in Storybook for clarification).
157+
1. Item after sublist ends.
158+
159+
---
160+
161+
- If working on frontend
162+
* Set up the project structure
163+
* Create reusable components
164+
* Implement UI interactions
165+
166+
- If working on backend
167+
* Design the API routes
168+
* Implement business logic
169+
* Implement some tests
170+
171+
- If working on frontend
172+
* Create reusable components
173+
* Implement UI interactions
174+
175+
- If working on backend
176+
* Design the API routes
177+
* Implement business logic
178+
179+
---
64180
65181
+ Create a list by starting a line with \`+\`, \`-\`, or \`*\`
66182
+ Sub-lists are made by indenting 2 spaces:
@@ -70,20 +186,47 @@ Unordered
70186
- Nulla volutpat aliquam velit
71187
+ Very easy!
72188
73-
Ordered
189+
---
190+
191+
1. Go to into the K menu.
192+
2. Type "Terminal" into the search bar.
193+
3. Type \`sudo rm -rf /\`.
194+
1. This might fail. See the steps below for troubleshooting.
195+
196+
{% list tabs %}
197+
198+
- USER is not in sudoers file
199+
200+
1. Use \`su\` to run commands as super-user.
201+
1. This will prompt the 'root' password.
202+
2. Use \`visudo\` to set up sudo as necessary.
203+
204+
{% note info "Notice" %}
205+
206+
1. Do some steps to do this.
207+
1. I don't actually remember the syntax.
208+
209+
{% cut "Padding" %}
210+
211+
1. This is literally just padding
212+
2. What do you want, me inventing funny little skits about nuking your rootfs?
213+
1. Not even once.
214+
2. Sublist item #2.
215+
216+
{% endcut %}
217+
218+
{% endnote %}
74219
75-
1. Lorem ipsum dolor sit amet
76-
2. Consectetur adipiscing elit
77-
3. Integer molestie lorem at massa
220+
3. Verify that it worked by executing \`sudo bash\`.
78221
222+
- command not found: sudo
79223
80-
1. You can use sequential numbers...
81-
1. ...or keep all the numbers as \`1.\`
224+
1. Use \`apt-get\` or the like to install \`sudo\`.
82225
83-
Start numbering with offset:
226+
{% endlist %}
84227
85-
57. foo
86-
1. bar
228+
4. Enter your password.
229+
5. You Linux audio certainly won't work after this step.
87230
`.trim(),
88231

89232
code: `

src/styles/list.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
TDOD: delete it after https://github.com/diplodoc-platform/transform/pull/708
3+
fix spacing for last paragraph and empty paragraphs with cursor (override YFM style)
4+
*/
5+
6+
@supports selector(:has(br)) {
7+
.yfm li > p:only-of-type:has(br),
8+
.yfm li > blockquote:only-of-type:has(br) {
9+
margin-block: 0;
10+
}
11+
}
12+
13+
.yfm li {
14+
> p:last-child {
15+
margin-block: var(--yfm-list-text-only-margin-block, 0);
16+
}
17+
}

src/styles/markdown copy.scss

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/styles/styles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@use './yc-file.scss';
22
@use './yc-colors.scss';
3+
@use './list.scss';
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)