quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.82k stars 309 forks source link

Splitting up lists is not intuitive or consistent #4600

Closed jthomasmock closed 1 year ago

jthomasmock commented 1 year ago

Bug description

Good morning Quarto crew!

Running on RStudio 2022.12.0+353 with Quarto 1.2.269 on Mac OSX

I would expect to be able to split up lists by providing a newline in between the list elements.

The Quarto Markdown docs do not cover how to "split up" lists, for example, long lists to be used in presentations or multi-column layouts. There are various ways depending on the markdown flavor based on Google search, but most are reliant on HTML, and it's not clear if they will transfer 1:1 across formats, for example, at Stack Overflow.

However, per the Pandoc guide, I guess the best method is a blank HTML comment which is parsed and ignored?

You can use the same trick if you want two consecutive lists instead of one big list:

1.  one
2.  two
3.  three

<!-- -->

1.  uno
2.  dos
3.  tres

In general, lists are kind of inconsistent across markdown flavors, and it may be worth beefing up the Quarto documentation or linking out to the canonical methods; again, see something like Stack Overflow or Pandoc guide.

Ideally, we could do something like this to safely and across format indicates to the Quarto/Pandoc parser that a list is broken up into several unrelated lists.

- List 1
- Still list 1
- Still list 1

\n

- List 2
- List 2

\n

- List 3
- List 3

However, the various mechanisms don't appear to work as far as I'd expect (and this reprex also breaks sourcecode embedding? đŸ˜¬ )

Reprex at: QuartoPub

---
title: "&nbsp;"
format: 
  html:
    code-tools: 
      source: true
---

# `layout-ncol`

Using two spaces and a blank return, this should be three columns with list elements in each but returns as one long list.

::::{layout-ncol=3}

- List 1  
- List 1  
- List 1  

- List 2  
- List 2  
- List 2  

- List 3  
- List 3  
- List 3  

::::

# `layout-ncol`

This should be three columns with list elements in each but adding `\n` breaks the orientation.

::::{layout-ncol=3}

- List 1  
- List 1  
- List 1  

\n

- List 2  
- List 2  
- List 2  

\n

- List 3  
- List 3  
- List 3  

::::

# `layout-ncol` with sub-div

This works, but requires manually "breaking" the list with another nested div

::::{layout-ncol=3}

- Column 1  

:::{#col2}

- Column 2  

:::

- Column 3  

::::

# `layout`

This works with a different layout, but only because the list is split up by paragraph of text.

::: {layout="[ [1], [1,1] ]"}

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

- Bullets
- More bullets
- Some additional bullets

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

:::


### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
cscheid commented 1 year ago

Can you try splitting them with empty divs instead?

::: {}
:::
mcanouil commented 1 year ago

Using fenced divs with no attributes works and is a more general approach to explicitly tell Quarto what are the blocks "layout" should use and split across columns.

I used that trick several times in a slow work in progress introductory slides to Quarto. Although, I added an id attribute to make it more "appealing".

AntheSevenants commented 1 year ago

I cannot get a grid layout to work when two lists should appear next to each other. I use the following snippet:

::::{layout-ncol=2 layout-nrow=2}
**Header 1**

**Header 2**

- this is the left list
- it should appear on the left

- this is the right list
- it should appear on the right
::::

However, what happens is that the right list just gets appended to the left list, and thus appears in the left column. I cannot add named or empty divs, because this messes with the flow of the rows. There is probably a more elegant way to do this, but I don't think this set-up is that exotic. Any pointers? Thanks!

AntheSevenants commented 1 year ago

I found the solution to my problem in this discussion. The correct syntax for my problem would be:

::: {layout-ncol="2"}

:::: {#first-column}
**Header 1**

- this is the left list
- it should appear on the left
:::

::: {#second-column}
**Header 2**

- this is the right list
- it should appear on the right
:::

::::

This produces the correct output: image

I would greatly appreciate more documentation, or at least examples, around the ways you can use the layout-ncol feature. Many thanks in advance.

cwickham commented 1 year ago

Proposed Actions: