Skip to content

Comments

Fix list indentation#2248

Merged
djrtwo merged 2 commits intoethereum:devfrom
hukkin:dev
Mar 30, 2021
Merged

Fix list indentation#2248
djrtwo merged 2 commits intoethereum:devfrom
hukkin:dev

Conversation

@hukkin
Copy link

@hukkin hukkin commented Mar 17, 2021

Fix Markdown list indentation so that the lists are rendered as expected.

BTW, these errors were made obvious while I was testing a Markdown formatter I've been working on against this repository. The formatter could be a good match for this repository, being able to format Markdown tables, create/remove word wrap if desired, generate table of contents, format embedded code blocks (Python with Black) etc. I could set up a PR to showcase if this is something of interest to you?

Copy link
Member

@ralexstokes ralexstokes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR! left some comments

Comment on lines +1301 to +1304
1. This has the benefit that clients can explicitly choose which RFCs to deploy
without buying into all other RFCs that may be included in that top-level version.
2. Affording this level of granularity with a top-level protocol would imply creating as many variants
(e.g. /protocol/43-{a,b,c,d,...}) as the cartesian product of RFCs inflight, O(n^2).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think the formatting change is fine although i will note that github renders the 1 and 2 sub-points as part of the outer numbered sequence so it goes 6,7,8,9 -- number 7 in the text is rendered as number 9

likely worth fixing to get meaning across

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ralexstokes ! This is precisely what this change fixes. Currently the inner list items are actually part of the outer list in Markdown abstract syntax. With the added indentation they truly become a separate inner list and the numbering works as expected when rendered to HTML.

Comment on lines +144 to 150
where `block_root` (an "0x" prefixed 32-byte hex string) and `epoch_number` (an integer) represent a valid `Checkpoint`.
Example of the format:

```
0x8584188b86a9296932785cc2827b925f9deebacce6d72ad8d53171fa046b43d9:9544
```
```
0x8584188b86a9296932785cc2827b925f9deebacce6d72ad8d53171fa046b43d9:9544
```

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

render seems fine and i'm happy w/ the formatting change

Copy link
Author

@hukkin hukkin Mar 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! To clarify, without this change, the list items 1. and 2. are in fact two distinct lists in Markdown abstract syntax (the second list being a list that start indexing from 2). This change makes them list items of a shared list.

@hukkin
Copy link
Author

hukkin commented Mar 28, 2021

Added one more commit to fix another case where a list was in fact two distinct lists in Markdown syntax.

Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!!

@djrtwo
Copy link
Contributor

djrtwo commented Mar 30, 2021

@hukkinj1 would it make sense to integrate the formatter into CI? Is the tool generally ready for that?

@djrtwo djrtwo merged commit ed6358a into ethereum:dev Mar 30, 2021
@hukkin
Copy link
Author

hukkin commented Mar 30, 2021

@djrtwo yes sure, but it's important to know that the tool is very opinionated, so it may be hard/frustrating for contributors to write Markdown that passes the check. That means that they should actually remember to run the formatter. I'd suggest a few different approaches:

  • Don't integrate in CI, but occasionally run the tool manually (not my favorite approach, issues like the ones in this PR will go undetected)
  • Integrate in CI, and provide an easy way for contributors to run the formatter as a git pre commit hook (I suggest the pre-commit tool. Essentially we add one configuration file, and the contributor will once run pre-commit install to activate, then forget about it)
  • Integrate in CI in a way where CI actually fixes the issues, and doesn't just complain. https://pre-commit.ci/ does exactly that.

@hukkin
Copy link
Author

hukkin commented Mar 30, 2021

Also if you want a PR to showcase, there is some (intentionally very little) configuration that should be decided upon.

  1. Should ordered lists be numbered consecutively, or all items with 1. (note this is perfectly fine according to spec, a Markdown->HTML renderer will render the numbers consecutive regardless). The default non-numbering style is great for minimizing diffs (explained in the docs)
  2. Should paragraphs be wrapped, and if yes, what line length. The default is to preserve word wrap (to support semantic line breaks, and again, to minimize diffs) (explained in the docs)
  3. Do we want to include plugins, enabling features such as
    • ToC autogeneration
    • Embedded code formatting (formatting Python with Black might make sense here)

@hukkin hukkin mentioned this pull request Mar 30, 2021
@hukkin
Copy link
Author

hukkin commented Mar 30, 2021

I opened #2291 already so you can have a look at how the formatting changes would look like. It's currently configured to

  • preserve word wrap
  • number ordered lists consecutively
  • no plugins besides the one for GFM support (versus plain CommonMark)

These are effortless to change ofc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants