gruehle / MarkdownPreview

Brackets extension for previewing markdown files
MIT License
276 stars 61 forks source link

Feature Request: code view needs to colorize bold & italics #77

Open andrewconnell opened 9 years ago

andrewconnell commented 9 years ago

Currently the code view colorizes a lot of things, but haven't found a way to configure it to make bold or italics text stand out when looking at the markup. We get colors with links, code, headings... this would be nice to have.

KPhoenix commented 9 years ago

If I'm understanding your request correctly, this is actually an issue for theme developers rather than extension developers. I guess since bold/italic styles aren't used in coding or scripting languages most of the time, the devs might forget that they are used in Markdown when they're choosing colors for their themes. (For what it's worth, Brackets itself is supposed to have bold text appear in boldface and italic text appear slanted, which would at least be something even without color, but apparently there's an issue with that and they've overridden it for now.) I would mention this request to the creator(s) of your favorite theme/themes, but in the meantime you can fix it yourself:

  1. Open your Brackets Extensions folder (Help > Show Extensions Folder), enter the "user" folder and find the theme you're currently using.
  2. Open the theme's "main.less" file.
  3. Somewhere inside that file—you may be able to skim through it and find a place that looks like it fits, but it shouldn't generally matter—paste the following (change the hex colors to whatever looks good with that theme):
span.cm-em {
    font-style: italic;
    color: #9598D6;
}
span.cm-strong {
    font-weight: 600;
    color: #826BBA;
}
span.cm-emstrong {
    font-style: italic;
    font-weight: 600;
    color: #826BBA;
}

Save the file and you should see properly highlighted bold/italic text if you open a Markdown file in Brackets while using that theme. :) The font-style and font-weight are optional if the issue the Brackets devs found bothers you as well.

It's not a perfect solution since a) you have to do it manually for any themes you want to use and b) if the creator updates the theme your changes will probably be overwritten, so you'll have to apply them again, but it does work. If you reach out to the creator of your theme they might make the color/style changes themselves, and that way the colors will be available for everyone and won't be overwritten by theme updates.

I've been wanting bold/italic highlighting for a good while and only recently found the styles I needed to change to make them work, haha. I hope this helps you, too!