Skip to content

Highlighing issues: Strikethrough and code highlights are conflicting #279

@gzagatti

Description

@gzagatti

Describe the bug

Write a text with an inline markup that mixes inline code or verbatim with another inline markup like bold or italic. This text will end up stricken through making it hard to read and against the writer's intentions:

image

Steps to reproduce

Activate tree-sitter and write something like:

Let's sum two numbers =(+ 1 2)= and again =(+ 3 4)=

This will cause the faulty strike.

Expected behavior

I would expect code or verbatim markup to take precedence over other inline markups like bold or italic.

Emacs functionality

In Emacs code or verbatim take precedence:

image

Also note that the orgmode manual is explicit about not processing code or verbatim string:

You can make words ‘bold’, ‘/italic/’, ‘underlined’, ‘=verbatim=’ and ‘code’, and, if you must, ‘+strike-through+’. Text in the code and verbatim string is not processed for Org specific syntax; it is exported verbatim.

Minimal init.lua

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]

local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'

local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'},
      {'kristijanhusak/orgmode.nvim', branch = 'master' },
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
    },
  }
end

_G.load_config = function()
  require('orgmode').setup_ts_grammar()
  require('nvim-treesitter.configs').setup({})
  
  vim.cmd[[packadd nvim-treesitter]]
  vim.cmd[[TSUpdate]]

  require('orgmode').setup()
end

if vim.fn.isdirectory(install_path) == 0 then
  vim.fn.system { 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }
  load_plugins()
  require('packer').sync()
  vim.cmd [[autocmd User PackerComplete ++once lua load_config()]]
else
  load_plugins()
  require('packer').sync()
  _G.load_config()
end

Screenshots and recordings

Screenshots provided above.

OS / Distro

Ubuntu 20.04

Neovim version/commit

0.7.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions