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

Markdown nested lists issue #138

Open
GoogleCodeExporter opened this issue Apr 18, 2015 · 5 comments
Open

Markdown nested lists issue #138

GoogleCodeExporter opened this issue Apr 18, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. With a document containing :

- item of the list
  - item of sublist
  - another

What is the expected output? What do you see instead?
in markdown output i get

 * item of the list
  * item of sublist
  * another

which doesn't fit the four spaces rule. It shouldn't it be the following ?

* item of the list
    * item of sublist
    * another

What version of the product are you using? On what operating system?
txt2tags version 2.6.825 <http://txt2tags.org>
on Linux Mint

Please provide any additional information below.

Original issue reported on code.google.com by nico.pou...@gmail.com on 20 Mar 2012 at 11:11

@GoogleCodeExporter
Copy link
Author

I don't think it's invalid. On 
http://daringfireball.net/projects/markdown/syntax I can read:
"List markers typically start at the left margin, but may be indented by up to 
three spaces. List markers must be followed by one or more spaces or a tab."

I don't think it's compulsory to indent with 4 spaces, it even seems not valid 
from the above rule.

Original comment by eforg...@gmail.com on 23 Mar 2012 at 6:57

@GoogleCodeExporter
Copy link
Author

Thank you for you quick answer.

Even if http://daringfireball.net/projects/markdown/syntax doesn't mention it 
(I can't see anything about nested lists by the way),
The "4 spaces" rule seems to be used for indentation levels and also for 
subsequent paragraphs in a list item. See 
http://daringfireball.net/projects/markdown/syntax#precode and 
http://daringfireball.net/projects/markdown/syntax#list).

About nested lists, the rule is explicit in 
http://stackoverflow.com/editing-help#advanced-lists
and for the pandoc documentation it's the chosen way too for markdown :
"The markdown syntax guide is not explicit whether the four-space rule applies 
to all block-level content in a list item; it only mentions paragraphs and code 
blocks. But it implies that the rule applies to all block-level content 
(including nested lists), and pandoc interprets it that way."

The first level items should start at the left margin and the the next level 
items ar four spaces distant the left margin : this way

* item in the first level
    * item in the second level
    * another item in the second level
* another item in the first level

Original comment by nico.pou...@gmail.com on 23 Mar 2012 at 7:25

@GoogleCodeExporter
Copy link
Author

I don't know what to do: markdown seems quite unclear about its inner rules, 
and there are several markdown dialects out there.

For example the way txt2tags actually behaves (nested lists without extra 4 
spaces) seems to work fine for http://www.tumblr.com, for diaspora, for linuxfr 
which all uses markdown. Maybe stackoverflow is using its own variation of 
markdown? 

Anyway, it doesn't seem to hurt to add those extra spaces as the examples above 
works well with them too. I tried to modify txt2tags, by editing the part 'md': 
 with 'listItemLine'          : '    ' instead of 'listItemLine'          : ' ' 
but it gives also an extra 4 spaces before the first item of the list, so I 
don't know how to do that at the moment.


Original comment by eforg...@gmail.com on 23 Mar 2012 at 10:24

@GoogleCodeExporter
Copy link
Author

What about doing what you dit : editing the part 'md':  with 'listItemLine'     
     : '    ' instead of 'listItemLine'          : ' ' 
and adding a rule in the doFinalEscape function to skip the 4 extra spaces.

something like 
elif target == 'md':
        txt = txt.replace('^ {4}(.*\*.*)', '\\1')
But I don't know if it is possible to use regex here...

Original comment by nico.pou...@gmail.com on 24 Mar 2012 at 2:58

@GoogleCodeExporter
Copy link
Author

I don't know if regex are supposed to work like this (I think it should be re. 
instead), but it seems I can't even replace a string which was just added with 
the txt2tags processing (like the 4 extra spaces). I don't know what to do as 
my python skills are very limited.

Original comment by eforg...@gmail.com on 24 Mar 2012 at 8:11

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

No branches or pull requests

1 participant