adobe / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
33.26k stars 7.64k forks source link

Markdown highlighting doesn't work as it should #11691

Open ghost opened 8 years ago

ghost commented 8 years ago

Hello,

I have been trying to ask this on IRC, but I'll write my question here too.

So, why Markdown syntax highlighting is not working? In Codemirror, when you surround text with - for example - two asterisks to make text bold, it becomes bold, but when doing same in Brackets, it has no effect.

See Markdown-mode demo here: http://codemirror.net/mode/markdown/index.html

I write a lot using Markdown and I would like to have proper syntax highlighting for it.

redmunds commented 8 years ago

You could create a Language in Brackets to use the CodeMirror mode, but I prefer using the Markdown Preview extension to see both the raw and formatted text at the same time.

ghost commented 8 years ago

I have Markdown Preview -extension installed, but I want also proper highlighting while writing.

I got it partially solved by installing Brackets Themes -extension and choosing theme right theme. So it seems to be theme problem partially. But then, if I hard-wrap words, the highlighting breaks, at least with lists so it's not problem only with theme.

petetnt commented 8 years ago

I agree with @mkoske here, I wonder why Brackets doesn't add syntax highlighting to Markdown formatting when all the other Codemirror Markdown editors seem to do it? I use Markdown Preview too, but raw markdown should receive the syntax highlighting styles:

As in

**hello world** should show up in editor as

image

instead of

image

petetnt commented 8 years ago

Oh, it's a bug:

See brackets_codemirror_overrides.less

/*
 * Temporarily override bold and italic syntax highlighting until
 * SourceCodePro supports them in a fixed pitch
 */
span.cm-em {
    font-style: normal;
}
span.cm-header, span.cm-strong {
    font-weight: normal;
}
span.cm-emstrong {
    font-style: normal;
    font-weight: normal;
}

Not sure if it has been fixed yet, the bolded letters seem to be very blurry but italics look okay?

image

@redmunds made that change back in 2012

ghost commented 8 years ago

I use Ttcn theme, and it works to some extent, e.g. I get bold text and italics too. But when I try to have list with hard-wrapped text, like this:

- item 1
- item 2, which is long
  and is hard-wrapped and intended,
- and this is next item

highlighting breaks. Hard-wrapped lines and item after that are not highlighted correctly. It works on the Codemirror demo-page I linked to in my first message.

So there's a bug somewhere.

attilaoroszdev commented 6 years ago

I see this issue is closed for years, yet none of the problems seem to have been solved. I came here searching for a solution to this exactly. Ended up having to manually override the codemirror overrides mentioned above for bold and italic items to correctly display in the editor. It does look good now, with no fuzziness so I guess this was an oversight?

attilaoroszdev commented 6 years ago

Sorry, my bad, don't know why I saw "closed" written on a green background... :) Anyway, this should be easy enough to solve now...