Extra leading spaces when wrapping list to fixed width
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 2k
- Forks
- 691
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 1
Description
Here is a simple Markdown list:
❯ cat ./list.md
- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in the list. That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on incredible stuff we're not used to see everyday](#link-3) - Line #3's description.
Re-wrapping this to a maximum length of 80 characters introduces 2 spaces before each lines:
❯ /System/Volumes/Data/usr/local/opt/cmark/bin/cmark --to commonmark --width 80 ./list.md
- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in the list.
That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on incredible
stuff we're not used to see everyday](#link-3) - Line \#3's description.
Here I expect cmark to get rid of these leading spaces and render as such:
- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in the list.
That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on incredible stuff
we're not used to see everyday](#link-3) - Line \#3's description.
Why? So we can fix a regression in pandoc. See how the previous flavor (markdown_github) behaved in that situation compared to the new one (gfm, based on cmark):
❯ pandoc --version
pandoc 2.9.2.1
Compiled with pandoc-types 1.20, texmath 0.12.0.1, skylighting 0.8.3.2
❯ pandoc ./list.md --to=markdown_github
[WARNING] Deprecated: markdown_github. Use gfm instead.
- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in
the list. That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on
incredible stuff we’re not used to see everyday](#link-3) - Line
\#3’s description.
❯ pandoc ./list.md --to=gfm
- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in
the list. That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on
incredible stuff we’re not used to see everyday](#link-3) - Line
\#3’s description.
I guess this behaviour should be somewhat configurable in cmark as pandoc does with the --tab-stop parameter:
❯ pandoc ./list.md --to=markdown_github --tab-stop=2
[WARNING] Deprecated: markdown_github. Use gfm instead.
- [Link 1](#link-1) - Description of line 1.
- [Link 2](#link-2) - A very long description for the second link in the
list. That description is more than 80 characters wide.
- [This is a very long title, pointing to an awesome article on
incredible stuff we’re not used to see everyday](#link-3) - Line \#3’s
description.
For reference, here the version of cmark I'm using, installed with brew on macOS Catalina:
❯ brew install cmark
(...)
==> Downloading https://homebrew.bintray.com/bottles/cmark-0.29.0_1.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/3a/3af95418f96f4b0cec4bd76abaab312f3caf4cea591f38d3b725f15068d06491?__gda__=exp=1593691219~hmac=7f6c15036b995f36438e934f5bd44ec8
######################################################################## 100.0%
==> Pouring cmark-0.29.0_1.catalina.bottle.tar.gz
🍺 /usr/local/Cellar/cmark/0.29.0_1: 17 files, 724.9KB
❯ /System/Volumes/Data/usr/local/opt/cmark/bin/cmark --version
cmark 0.29.0 - CommonMark converter
(C) 2014-2016 John MacFarlane
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the list-wrapping output with the cmark command-line entry point and the reported width of 80. Inspect the list rendering and wrapping behavior, then add or update coverage for the example; done means wrapped list items do not gain the extra two leading spaces while continuation lines remain correctly indented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100