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

Nested lists are flattened when converting from gdocs paste source #445

Open
bachbui opened this issue Mar 3, 2020 · 4 comments
Open

Nested lists are flattened when converting from gdocs paste source #445

bachbui opened this issue Mar 3, 2020 · 4 comments
Labels
🐞 Bug This is identified as a bug or is fixing a bug
Projects

Comments

@bachbui
Copy link
Contributor

bachbui commented Mar 3, 2020

In a Google Doc, you can create a nested list like

1. List item
2. List item
   a. Nested list item
   b. Nested list item
3. List item

This is represented in GDocs as a single list with 5 list items, where the outer items have attributes ls_nest: 0 and in nested items have attributes ls_nest: 1. When converting this from the GDocs source to Offset, we drop the ls_nest attribute and just produce a list with 5 elements.

What do you expect to happen?

Produce annotations like:

List item\nList item\nNested list item\nNested list item\nList item
                      ^-----item-----^  ^-----item-----^
                      ^------ List { level: 2 } -------^ 
^-item--^  ^-item--^  ^------------- item -------------^  ^-item--^
^---------------------- List { level: 1 } ------------------------^

What happened instead?

Produced annotations like:

List item\nList item\nNested list item\nNested list item\nList item
^-item--^  ^-item--^  ^-----item-----^  ^-----item-----^  ^-item--^
^----------------------------- List ------------------------------^

Environment

Software Version(s)
Node 10
Lerna 3.2
npm 6.4
Browser Chrome 80
@tim-evans
Copy link
Collaborator

tim-evans commented Mar 3, 2020

@bachbui This is exactly why we have the level attribute on lists. Our intention was to use level to mark the list indentation.

I also thought there was some code around this in the GDocs paste source, but I may be totally wrong 🙃

@tim-evans tim-evans added the 🐞 Bug This is identified as a bug or is fixing a bug label Mar 3, 2020
@tim-evans tim-evans added this to To do in 🏭 Work via automation Mar 3, 2020
@bachbui
Copy link
Contributor Author

bachbui commented Mar 3, 2020

We'd set the level, yes, but the main point of difference is GDocs models this as a single list with nested list items, whereas Offset would model this as two separate lists, one nested inside of another. We are not doing anything in the converter to split the single list from GDocs.

@bachbui
Copy link
Contributor Author

bachbui commented Mar 3, 2020

Updated the example above with the appropriate level attribute

@bachbui
Copy link
Contributor Author

bachbui commented Mar 4, 2020

I think it'd also be reasonable also to follow the lead of GDocs here and set the nesting level at the item level rather than the list level. From what I can tell, we aren't looking at the list level in most (all?) renderers anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug This is identified as a bug or is fixing a bug
Projects
🏭 Work
  
To do
Development

No branches or pull requests

2 participants