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

Text styling (color, bold, italic, underline etc) #266

Open
gitaarik opened this issue Apr 3, 2024 · 2 comments
Open

Text styling (color, bold, italic, underline etc) #266

gitaarik opened this issue Apr 3, 2024 · 2 comments

Comments

@gitaarik
Copy link

gitaarik commented Apr 3, 2024

This example image is used in the nvim-notify README.md:

image

I wonder how the g:my_cool_setting gets its orange color and how the code is highlighted. I wonder if it's possible to style text to give it a custom color make it bold or italic.

@rcarriga
Copy link
Owner

rcarriga commented Apr 6, 2024

You can apply markdown highlighting as detailed in the README, which will allow injecting code blocks

nvim-notify/README.md

Lines 123 to 129 in 5371f4b

vim.notify(text, "info", {
title = "My Awesome Plugin",
on_open = function(win)
local buf = vim.api.nvim_win_get_buf(win)
vim.api.nvim_buf_set_option(buf, "filetype", "markdown")
end,
})

@gitaarik
Copy link
Author

gitaarik commented Apr 6, 2024

Aha ok, yea I guess that's it, although I do see the backticks:

image
  local text = [[
    Test `g:my_cool_setting`
    ```lua
    print('hi')
    ```
  ]]

  vim.notify(text, "info", {
    title = "My Awesome Plugin",
    on_open = function(win)
      local buf = vim.api.nvim_win_get_buf(win)
      vim.api.nvim_buf_set_option(buf, "filetype", "markdown")
    end,
  })

And it would be nice if you could manually set styles. For example if I have a option that I can toggle on / off, I would like to have the text be green or red. I don't want to use the "error" log level for "off", because it's not an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants