How do I stop underscores turning text purple?

I have a site that I am now editing with Atom.

One of the conventions of the site is that some image names are formatted like this:

category_-_image_name_which_might_be_long.jpg

However, when I include an image with this naming format in an tag in Atom, all text after the underscores turns purple and italic. It over rides all other formatting colors for tags or elements, thus reducing the readability of the file.

I’m guessing a dash and underscore combination is some kind of special character designation in Atom, but, it’s not something I want.

Can I turn it off?

That should only happen in a markdown file (where underscore means italics), unless a package you’ve installed is applying it to other files too. What is the extension of this file?

The extension of the file is .md, which I’m assuming is a markdown file. It’s a new format for me, as I’ve just started experimenting with using Grav as a CMS.

In any case, it is the combination of a dash and underscore, -_, that causes the purple italic underscore.

Is there no way for me to turn this off? It is not helpful for my specific editing situation.

You can escape any character that’s reserved for formatting by prefixing it with \.

What exactly are you trying to achieve? Can you post a code snippet or screenshot? Markdown has its own syntax for embedding images. While you can use HTML inside Markdown, it ? not be necessary.

The _-_ is a part of an image file name. If I put in a \ to escape it, it does turn off the purple italic formatting, but then the image can not be found when the page is displayed.

Using _-_ as part of image names is a in house naming convention for keeping files organized that has in use since before starting using Atom, and we are not going to go back and rename all our files and change our procedures in order to conform to Atom.

This is what it looks like.

That looks like HTML, not markdown. The file should probably have a .html extension instead.

You could alternatively associate .md with HTML, but that would mess with actual markdown files.

There are HTML parts of the file, but it is not exclusively HTML. Grav uses some markdown, but some of the file is pulled in from other sources.

In any case, the issue isn’t about what file type is the best for the end purpose. The point is that underscores are triggering a certain kind of format, and I’d like to turn off that trigger. In other IDEs, like Netbeans, it’s possible to configure the interface to change this kind of thing. Is it not possible in Atom?

If it’s simply not possible, then I’d like to know so I can decide if Atom is the right editor for me or not.

Atom is about as configurable as can be, but the extent to which you can change it has varying difficulty. In this case, there is no fine grained configuration of what the grammar picks up. You would need to find a grammar that understands your markdown flavour (or is stricter about the italic rule, like language-markdown), or fork and change the language-gfm package.

You could also change the style of italics to be plain, but that just hides the problem and could cause weird issues where actual markdown isn’t picked up because it thinks it’s inside an italics area.

What I understand from what your saying is that it is technically possible to configure Atom to ignore the underscores, but that it’s so complicated to set up that I won’t realistically be able to do it.

Editing the grammar would probably put off most people. But you should first try language-markdown because it is stricter about when it applies italics, and probably won’t match the ones in your file names.

Thank you for the suggestion, but I don’t want to take one a whole scripting language, or whatever “language-markdown” is, just to make a small configuration.

If it’s not possible to make this adjustment by selection an option in a preferences interface, or making a simple edit in a configuration file, then anything beyond that is beyond me.

It’s just an alternative markdown syntax highlighting package. No setup required, besides installing it (can do this on the command line or through the install tab in Atom settings). It will probably make a popup saying to disable language-gfm, which is the default markdown syntax highlighter, and you should do so.

Aerijo, thank you for persisting through my skepticism and letting me know it was just a matter of installing a certain package.

I installed the “language-markdown” package by going to File->Settings->Install and searching for that package and simply clicking “install”. First thing after it installed, I looked at the settings, and I saw a check box next to “disable language-gfm”, so I did that, as you suggested.

And voilà, the purple text that was bothering me is now gone. It was as easy as you said, no complicated configurations or having to learn any scripting language or anything.

Much appreciated. I’m back to seeing my code clearly.

I’m unfamiliar with the norms of this discussion board. Is there no way to mark this thread as “solved”, or mark the accepted answer, or anything like that? Doesn’t seem to be…

What I apprehend from what your saying is that it’s miles technically feasible to configure Atom to disregard the underscores, however that it’s so complex to installation that I received’t realistically be able to do it.