Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Markdown syntax error

golszewski-toolla
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 30, 2019

Hi,

I have a problem with Markdown syntax in README.md, in particular with code blocks. Many tools including Markdown editor embedded in Eclipse IDE and some online editors (like https://stackedit.io or https://www.markdowntutorial.com/) work perfectly fine with my Markdow syntax. However, Bitbucket cloud for some reasons reports errors in my syntax despite I can't find any issues with it.

Here is the content of my README.md file: https://pastebin.com/dp99JeaH

And here is how it renders. As you can see, some (but not all) code blocks have text highlighted in red and the generated html contains span with class err suggesting something is wring with the syntax.

Any ideas what am I doing wrong?

markdown.jpg

1 answer

1 accepted

2 votes
Answer accepted
Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 30, 2019

Hi @golszewski-toolla,

Bitbucket Cloud uses CodeHilite for code highlighting in the markdown code blocks. It is configured to try guess code block language when it's not specified explicitly. What you see is a failure of guessing language (which is expected for your example as code blocks don't contain any code).

I'm not sure whether highlighting as an error in such case is what we actually want there, I'll raise this with the team.

Meanwhile, you can avoid misleading highlighting by adding explicit language text to your code blocks, like this:

```text
GET /lorem
```

``` text
Spaces between backticks and language name are fine too.
```

This should do the trick. Let me know if you have questions.

Cheers,
Daniil

golszewski-toolla
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 31, 2019

Hi @Daniil Penkin,

Thank you for your response. I couldn't understand why the 1st and 2nd code blocks are displayed correctly whereas the 3rd and 4th have errors. But now it makes sense - the first two blocks were recognized as "bash" language, hence no syntax error.

I think it's a bit counter-intuitive to display error for unrecognized language. You're right my block doesn't contain any code, I just wanted to created a monospace text block like with html pre tag.

Anyway, specifying text removes the syntax error and I'm happy with this solution. Thank you again!

Daniil Penkin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 31, 2019

I agree, markdown rendering (including code blocks highlighting aspects) definitely has as list of things to improve. We know about it, and this topic is on our backlog. Hopefully we'll get to it sooner rather than later.

Cheers,
Daniil

Like Gratien Falcoz likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events