Reputation: 2099
I'm using Markdown for my README.md on Bitbucket and realize my ordered list restart to 1 after a code block. Here is an example of my text:
1. Download VirtualBox
2. Download Vagrant
3. Clone the repository
> git clone URL
4. Go to repository folder
> cd /my_repo
5. Setup your dev environment
The number 4 and 5 are both 1.
in my README, which is not what I want. Maybe should I use the `` instead? The result won't be the same style but if my list keep the numbering it would be better at least.
Any solutions?
Upvotes: 15
Views: 4741
Reputation: 8881
To expand on @Willian's solution, try to just indent the code 8 spaces, it seems to enable basic block highlighting, not code syntax. Also, it won't work if you have some bullets nested before the code. Like if you had a couple bullets nested under #3 before the code.
1. First item
2. Second Item
3. Some code example:
var a = "Some string";
function test() {
return a + "/n";
}
4. Forth item
Upvotes: 0
Reputation: 2031
Just to summarize the comments above for users running into this issue on BitBucket here's a snippet of code that I use a README.md boilerplate for my nodejs/express projects that works:
**Instructions**
1. Clone the git repo from BitBucket
```
cd *Install_Directory*
git clone https://[email protected]/user/repo.git
```
2. Install/upgrade required npm modules
```
npm update
```
3. Run
```
node server.js
(or)
nodemon
```
4. View tracking dashboard by visiting http://localhost:9988/
And for completeness here's the output using StackOverflow's markdown parser:
Instructions
Clone the git repo from BitBucket
cd *Install_Directory*
git clone https://[email protected]/user/repo.git
Install/upgrade required npm modules
npm update
Run
node server.js
(or)
nodemon
View tracking dashboard by visiting http://localhost:9988/
Upvotes: 0
Reputation: 1268
An even better answer, the general structure should be like this:
1. item n.1
2. item n.2
#!json
{
"key": "value"
}
3. item n.3
So:
#!<language-name>
indented with 8 spaces before your code block.Bitbucket will respect the list numbering and you won't lose the syntax highlighting.
Upvotes: 7
Reputation: 22478
Insert 4 spaces before the blockquotes >
. This serves two purposes at once: first, it indents the quote, so it aligns with the number above it (as it is part of that numbered item). Second, most MD parsers know this means the indented item should not interrupt the numbered list.
Actually, I think you're wrong to use a "block quote". Maybe you should use a regular indented 'code' here, using 4 spaces and backticks around your literal code:
Clone the repository
git clone URL
(Four spaces and ` around the command line.)
Upvotes: 15