Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to render italics in Markdown #84

Closed
lokesh-krishna opened this issue Dec 11, 2017 · 13 comments
Closed

Unable to render italics in Markdown #84

lokesh-krishna opened this issue Dec 11, 2017 · 13 comments

Comments

@lokesh-krishna
Copy link

I admit that I am not sure if this is an issue with my terminal (rxvt-unicode now and Gnome Terminal earlier) or the theme but while I am able to see bold as well as bold italic, italic never renders, appearing instead as regular text.

I know the terminals are capable of rendering italics as I checked that by running echo -e "\e[3mfoo\e[23m" and the text did render in italics.

Could you offer some insight into the matter? Please let me know if you require any information.

@arcticicestudio
Copy link
Contributor

Does it work if you enable the theme configuration for italic comments?
Also is it reproducible with other color schemes?

I've shortly checked the theme and noted that the markdownItalic and markdownBold are indeed not set. Can you try to add the following to the theme and check if it fixes italics?

hi! link markdownItalic Italic
hi! link markdownBold Bold

@lokesh-krishna
Copy link
Author

lokesh-krishna commented Dec 15, 2017

I tried enabling italic comments and that too doesn't work.

I've never used a theme before that actually rendered markdown in italics. The base16 ones I used simply used colors and one of the things I really appreciate this theme is that it actually formats instead of coloring. If you could recommend some theme that does render italics in italics then I'll try it out.

I tried adding what you suggested but that too didn't fix italics :(

@lokesh-krishna
Copy link
Author

Could you please consider highlighting italics, bold and bold italics using colors instead of formatting?

Maybe offer formatting as an option the way that you do with comments. I would love to see it formatted but seeing how you warn about italics for comments with respect to terminal support, what do you think of offering colored highlighting as the default when it comes to Markdown?

@lokesh-krishna
Copy link
Author

Tested it with no color scheme at all and italics works there.

@dylnmc
Copy link
Contributor

dylnmc commented Dec 18, 2017

This theme uses italics (if you enable italics via a global flag before using colorscheme nord). Read the README to see how to enable or disable italics.

It seems like you're having another problem, or you're not following the README, but I can't tell because you're just asking to (not?) support italics (it does), but you're not clearly stating the exact problem.

Italics has nothing to do with the colorscheme. A colorscheme may use italics, by doing something like hi Comment cterm=italic gui=italic, but italics themeselves lie even outside of vim, as vim merely uses the terminal (well, gvim can handle italics) to handle italics. Some terminals support italics. It seems like yours does not (though, I cannot say for certain). This colorscheme allows Comments to be italicized via vim (and via the terminal if you're in the terminal if it is supported) and only if you enable it with let g:nord_italic_comments = 1 before you set colorscheme.

The only way I know how to help you, is if you say what terminal you're using and what the problem is, and may I suggest using a minimal vimrc (ie, backup your current vimrc and make a small vimrc to see if the problem persists), such as:

" load nord with plugin manager or put nord.vim in ~/.vim/colors
let g:nord_italic_comments = 0  " do not use italics
colorscheme nord  " use nord colorscheme

Be sure to disable italics before colorscheme nord, although they are disabled by default.

You can set anything you want for Comments, for example. Eg, use this:

augroup Nord
    autocmd ColorScheme nord highlight Comment ctermfg=58 cterm=NONE
augroup end

^ that will make Comments a really ugly dark green and make sure that no italics are enabled. Change 58 to whatever you want (0-255). Hint: 0-15 are the colors set by nord (eg, 4-bit colors set by nord).

Finally, keep in mind that things get finicky if you use tmux. I remember having a hard time getting italics to work properly in tmux.


cheers,
dylnmc

@lokesh-krishna
Copy link
Author

lokesh-krishna commented Dec 18, 2017

This theme uses italics if you enable italics via a global flag before using colorscheme nord.

Thanks a lot for this. I tested this earlier by adding this line after setting the color scheme and that didn't have any effect. Adding it before does show comments in italics. It also fixes italics in Markdown files.

@arcticicestudio So yes, that flag does fix things but I would like to have italics only for italics in Markdown files, not for comments. Is there anything I can do to make things that way?

Also, @dylnmc my problem was that text I'd formatted as italic in Markdown files were not being highlighted as italics, which is what this theme is supposed to do. It does this for bold and bold italics and that works fine. Sorry if my problem wasn't clear.

@dylnmc
Copy link
Contributor

dylnmc commented Dec 18, 2017

seems you're right. Thanks for clearly stating the problem.

@arcticicestudio ... in markdown files, *hello* is hl group markDownItalic =[linked to]=> htmlItalic =[linked to]=> Italic.

  • verbose hi Italic yields:
Italic         xxx cterm=italic gui=italic
	Last set from ~/vimfiles/plugged/nord-vim/colors/nord.vim

culprit: https://github.com/arcticicestudio/nord-vim/blob/develop/colors/nord.vim#L121


I guess maybe just handle italics not just for comments, (see your s:hi() function), but it's all up to you, obviously.

Cheers,
dylnmc

@arcticicestudio
Copy link
Contributor

I've been thinking about adding a configuration to allow users to enable italics.The implementation can be made using a variable which gets initialized with italic when the configuration is enabled, otherwise the variable will be a empty string.

@lokesh-krishna
Copy link
Author

Is there anything one can do presently to have italics in markdown files but not for comments?

@dylnmc
Copy link
Contributor

dylnmc commented Dec 19, 2017

augroup MyNordChanges
    autocmd!
    autocmd ColorScheme nord highlight Comment cterm=NONE gui=NONE
    autocmd ColorScheme nord highlight Italic cterm=italic gui=italic
augroup end

@lokesh-krishna
Copy link
Author

Thanks a lot! Correct me if I'm wrong but just adding this much, before declaring the color scheme seems to do exactly what I want:

autocmd ColorScheme nord highlight Italic cterm=italic gui=italic

I no longer have let g:nord_italic_comments = 1 though.

Anyway you could make this the default behaviour of the color scheme, with a PR? Provided @arcticicestudio approves.

@dylnmc
Copy link
Contributor

dylnmc commented Dec 20, 2017

Your autocmd does do what you desire. I was just more explicit and handled some edge cases.


You wouldn't want to make italics available by default, but I think, arcticice is considering making italics easier to deal with when one might want italics (for example in markdown, with comments, etc). A lot of terminals (and some fonts) do not support italics.

I might have a go at a small refactor and submit a PR if and see what @arcticicestudio thinks. But I also know how tidy and organi{s,z}ed arcticice is, so I feel like I might just be trampling on toes. Nonetheless, I agree that italic support should be improved.

arcticicestudio added a commit that referenced this issue Dec 29, 2017
The configuration to enable italic comments (1) is like the name suggests
limited to comments only, but there are other use cases like the
italic style in Markdown (2).

This commit adds a new theme configuration to explicitly enable italics.
The configurations is enabled by default when running in "gui" mode and
is disabled by default in "term" mode.

The reason for this standard behavior is the fact that there are still
shells and terminals which are not able to handle italics. Enabling
italics for terminals by default would cause unpredictable bugs and
graphical glitches.

The new configuration is named "nord_italic".

References:

  (1) https://github.com/arcticicestudio/nord-vim#italic-comments
  (2) #84

GH-88
arcticicestudio added a commit that referenced this issue Dec 29, 2017
The configuration to enable italic comments (1) is like the name suggests
limited to comments only, but there are other use cases like the
italic style in Markdown (2).

This commit adds a new theme configuration to explicitly enable italics.
The configurations is enabled by default when running in "gui" mode and
is disabled by default in "term" mode.

The reason for this standard behavior is the fact that there are still
shells and terminals which are not able to handle italics. Enabling
italics for terminals by default would cause unpredictable bugs and
graphical glitches.

The new configuration is named "nord_italic".

References:

  (1) https://github.com/arcticicestudio/nord-vim#italic-comments
  (2) #84

GH-88
@arcticicestudio
Copy link
Contributor

I've submitted #89 which adds a new option to explicitly enable italics. The nord_italic_comments option now requires the new option to enabled in order to take effect. I'll add the missing groups for the Markdown syntax to fix the problem with italic syntax styles.

@arcticicestudio arcticicestudio added this to the 0.7.0 milestone Dec 30, 2017
arcticicestudio added a commit that referenced this issue Dec 30, 2017
Include both groups to make sure the formatting is applied correctly
even when the default linked group "Italics" changes.

GH-84
arcticicestudio added a commit that referenced this issue Dec 30, 2017
Include both groups to make sure the formatting is applied correctly
even when the default linked group "Italics" changes.

GH-84
arcticicestudio added a commit that referenced this issue Dec 30, 2017
…-in-markdown

Add groups for italic and bold text in Markdown
@arcticicestudio arcticicestudio removed their assignment Feb 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants