Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List block: Can't start the first sentence with "1. " without the block changing to List #17038

Closed
andreamiddleton opened this issue Aug 14, 2019 · 6 comments · Fixed by #14776
Labels
[Block] List Affects the List Block

Comments

@andreamiddleton
Copy link
Contributor

I'm trying to write a list of steps that includes block quotes between each numbered step. This breaks expected behavior for the list block, which is fine — I didn't expect the list block to be able to format around my additional blocks between numbered items (though that would be nice).

The problem comes in when I try to start a text block like "2. Then we did this thing..." Starting the first sentence in a block with number + . + space results in the block turning into a list block (and thus indenting, which I don't want it to do, because then it looks weird with my block quotes). If I try to convert it back to a text block, the number goes away. >:-(

My workaround is to open up "code mode" and painstakingly find the paragraph I'm looking for, and add the number, period, and space. Yuck!

I wish the convert-to-list-block feature were smart enough to detect that if I revert back from List block a few times in a row, I don’t want the List block.

@karmatosed
Copy link
Member

karmatosed commented Aug 14, 2019

My workaround is to open up "code mode" and painstakingly find the paragraph I'm looking for, and add the number, period, and space.

I am making a scrunchy face as really we should ensure that is not a workaround.

I wish the convert-to-list-block feature were smart enough to detect that if I revert back from List block a few times in a row, I don’t want the List block.

This really is a great piece of feedback. Remembering the past state seems like a win here.

@karmatosed karmatosed added the [Block] List Affects the List Block label Aug 14, 2019
@ellatrix
Copy link
Member

Thanks, @andreamiddleton, for raising this issue! It's certainly on my radar. There's even a PR for it (#14776), which I need to rewrite a bit. I'll prioritise it today.

While I understand that you'd like the "input rule" that converts 1. to be more easily reverted, I have a harder time understanding the bigger writing issues.

Starting the first sentence in a block with number + . + space results in the block turning into a list block (and thus indenting, which I don't want it to do, because then it looks weird with my block quotes).

Only 1. or 1) should automatically convert the paragraph to a list. There's no rule that converts any number other than 1 to a list. Is this the case for you? Maybe I'm misunderstanding this part.

I'm trying to write a list of steps that includes block quotes between each numbered step. This breaks expected behavior for the list block, which is fine — I didn't expect the list block to be able to format around my additional blocks between numbered items (though that would be nice).

Could you share the final HTML structure you're looking for? Or the final block structure as an image? I think I know what you mean, and I agree that it would be nice. There are multiple solutions to this problem I think -- correct me if I'm wrong.

  1. Allow the user to restart the numbering. There's an HTML attribute for that, see List Block: add type attribute for ordered list #13888. There's even a PR in the works.
  2. Allow lists to contain more than just a line of text. I'm not sure if that's what you're looking for.
  3. Sometimes, when the list content becomes too big, headings are a better solution to structure the content. I'm not sure if that would work in your situation. I think in the future, Gutenberg should also allow heading to be automatically numbered.

@bfintal
Copy link
Contributor

bfintal commented Aug 15, 2019

@andreamiddleton As @ellatrix mentioned, paragraphs do auto-convert into list blocks, but only on 1. or 1) . It doesn't do so for 2 and above.

One workaround to get back the 1. number/paragraph block is to hit undo right after it converts into a list block :)

This also works with * bullet lists.

@andreamiddleton
Copy link
Contributor Author

Ah, I apologize @ellatrix -- for some reason I recall the list block converting automagically for 2. but I can't reproduce it so I must be wrong.

I didn't know about the "undo" workaround for the list block conversion action, thanks! The convention I'm used to = backspace-based.

Here's an example of my ideal for this particular article, anyway (though this is not the actual content of course): https://docs.google.com/document/d/1CNVLN5AUekFetc-qr8iX9aTj6kujJrCMA-AYLj58gD0/edit?usp=sharing

@ellatrix
Copy link
Member

No worries, thanks for testing! :)

I didn't know about the "undo" workaround for the list block conversion action, thanks! The convention I'm used to = backspace-based.

Yeah, we should definitely add that. It's a work in progress (#14776), hopefully part of the next WordPress release.

Here's an example of my ideal for this particular article, anyway (though this is not the actual content of course): https://docs.google.com/document/d/1CNVLN5AUekFetc-qr8iX9aTj6kujJrCMA-AYLj58gD0/edit?usp=sharing

Thanks for sharing! It's unclear to me whether the sections in between the list items are part of the list or not. Which structure are you looking for? Or does it not really matter? I guess visually it could more or less look the same, and semantically either works fine too?

<ol>
  <li>Item one...
    <blockquote>Quote one...</blockquote>
  </li>
  <li>Item two...
    <blockquote>Quote two...</blockquote>
  </li>
</ol>
<ol start="1">
  <li start="1">Item one...</li>
</ol>
<blockquote>Quote one...</blockquote>
<ol start="2">
  <li>Item two...</li>
</ol>
<blockquote>Quote two...</blockquote>

Option number two will be possible in the next Gutenberg version. For option number one we will have to allow blocks inside list items, instead of only allowing text.

I wonder if @zeldman has any opinion on this. :)

@ellatrix
Copy link
Member

Funnily enough, it looks like I also cannot have a code block inside a list item in the above comment. It's just not possible in Markdown. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] List Affects the List Block
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants