DEV Community

bredmond1019
bredmond1019

Posted on

Having Trouble Creating Blocks of Code in my Blog Posts on Dev.to

Hi all,

I recently just posted an article on here -- a tutorial for Flask -- and I was having trouble using the code blocks they supply us on here for markdown.

For example, I had this below block in one part of my blog.

from flask import Flask        
app = Flask(__name__)

@app.route( / )        
def index():            
     return <h1>Hello World!</h1>
Enter fullscreen mode Exit fullscreen mode

Then I copied this exact block down further and this is what I got:

`python
from flask import Flask

app = Flask(name)

@app.route( "/" )

def index():

return "

Hello World!

"
`

I was able to replicate this by adding a space inbetween the three ` marks. However, I didn't add the space in my blog, I literally copied and pasted what you see in the first block that actually works.

Any thoughts?

I was able to get it to work by just indenting all of the code, but I wanted to use the following version, and I wasn't able to with just indenting.

 ` ` `python
 code here
 ` ` `
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
itscasey profile image
Casey 💎

Hey! Thanks for reporting/talking about this. I tried to recreate the issue you had but was unable to. This potentially could have been due to an extra tick(or even a missing one) somewhere. I did check your post and it seems like you weren't missing(or had an extra) any ticks.

If you experience this again, please let us know at yo@dev.to!