2

I would like to display the following

$ env/bin/python
>>>import requests
>>> requests.get('http://dabapps.com')
<Response [200]>

as a code sample within a bullet paragraph for Github styled markdown. How do I do it?

Sun Bear
  • 7,594
  • 11
  • 56
  • 102
  • 1
    Indent it a whole bunch. I don't know how much, but keep indenting in 4 space increments until it works :p – Alexander Nov 23 '18 at 17:55
  • @Alexander Thanks for the idea. After trying, I discovered that I needed a blank line with 4 leading space, above and below my code sample. Also I needed 4 spaces plus 1xTab for each line of the code sample. The 4 leading spaces is to align the text in the code sample with the text in the bullet paragraph. The 1xTab then created the code sample. – Sun Bear Nov 23 '18 at 18:49

2 Answers2

1

Legend:

  • ---- denotes 4x leading spaces.
  • 1xTab denotes pressing the Tab key once.
  • ----1xTab denotes 4x leading spaces plus pressing the Tab key once.

The syntax format I found to work and implement in Remarkable:

1. 1st Bullet point: 
----    
----1xTab$ env/bin/pip install requests
----
----1st Bullet point paragraph
----    
----1xTab$ env/bin/python
----1xTab>>>import requests
----1xTab>>> requests.get('http://dabapps.com')
----1xTab<Response [200]>
----        
2. 2nd Bullet point:

Result:

  1. 1st Bullet point:

    $ env/bin/pip install requests
    

    1st Bullet point paragraph

    $ env/bin/python
    >>>import requests
    >>> requests.get('http://dabapps.com')
    <Response [200]>
    
  2. 2nd Bullet point:

Sun Bear
  • 7,594
  • 11
  • 56
  • 102
  • BTW, as far as markdown is concern, spaces and tabs are the same. The indentation could have been entirely spaces, depending on which your source code to have – Alexander Nov 23 '18 at 19:45
1

You could also do this using a fenced code block:

* Bullet list item 1
* Bullet list item 2
  ```
  $ env/bin/python
  >>>import requests
  >>> requests.get('http://dabapps.com')
  <Response [200]>
  ```
* Bullet list item 3

See below for markdown preview in Atom:

enter image description here

And here it is in Remarkable:

enter image description here

Adam J Limbert
  • 121
  • 1
  • 1
  • 9
  • Thanks. I tried it in "Remarkable" but strangely it did not work. Don't know why it did not work. :( – Sun Bear Nov 26 '18 at 16:54
  • Hi @SunBear I just tried it with this online [Remarkable demo](https://jonschlinkert.github.io/remarkable/demo/) and it worked for me just fine... – Adam J Limbert Nov 27 '18 at 00:46
  • Related: [Markdown: continue numbered list](https://stackoverflow.com/questions/18088955/markdown-continue-numbered-list) – Adam J Limbert Nov 27 '18 at 02:11
  • 1
    I am using Remarkable ver. 1.87 app. It's 'Help-->Github' had directed me to this other [homepage](https://github.com/jamiemcg/Remarkable). This app and version is giving me the issue.The use of **Indented code** and **Fence** should both work. Not sure why the 'fence' approach did not work in this app. :( Really appreciate the links you had provided. ;) – Sun Bear Nov 29 '18 at 02:44