python - End literal block in list item -


i have list item in rst file put literal block into, unable literal block end properly.

this rst:

1. item 1 (not literal) 2. item 2::      mycode.example()      description of code shown above (not literal) 

i paragraph starting description outside literal block above it, still part of list item #2. workaround have been able come this:

1. item 1 (not literal) 2. item 2:      ::          mycode.example()      description of code shown above (not literal) 

this allows non-literal text return previous level of indentation, making way want to. however, have :: in first line of list item.

is possible end literal block explicitly in way allow :: stay in first line of list item?

yes. whitespace tricky. have 1 leading space in code , line starting "description". try this:

1. item 1 (not literal) 2. item 2::         mycode.example()     description of code shown above (not literal) 

note first letters of item , description vertically align , code blocks indented 4 spaces.

bonus tip: add space between numbered items , period starts @ column 5. makes easier indent paragraphs 4 spaces (and code blocks 8 spaces) in editor. , in case have more 9 items, indentation looks nicer items 10-99.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -