nvim-neorg / neorg

Modernity meets insane extensibility. The future of organizing your life in Neovim.
GNU General Public License v3.0
6.51k stars 214 forks source link

Neorg cannot export @math tag! #401

Closed josephsdavid closed 2 years ago

josephsdavid commented 2 years ago

Prerequisites

Neovim Version

v0.6.1

Neorg setup

require("neorg").setup({
    -- Tell Neorg what modules to load
    load = {
        ["core.defaults"] = {}, -- Load all the default modules
        ["core.gtd.base"] = {
            config = {
                -- workspace =   "example_gtd" , -- assign the workspace,
                workspace = "home",
                exclude = { "notes/" }, -- Optional: all excluded files from the workspace are not part of the gtd workflow
                projects = {
                    show_completed_projects = false,
                    show_projects_without_tasks = false,
                },
                custom_tag_completion = true,
            },
        },
        ["core.presenter"] = {
            config = {
                zen_mode = "truezen",
            },
        },
        ["core.integrations.telescope"] = {}, -- Enable the telescope module
        ["core.integrations.truezen"] = {}, -- Enable the truezen module
        ["core.export"] = {}, -- Enable the truezen module
        ["core.export.markdown"] = {}, -- Enable the truezen module
        ["core.norg.journal"] = {config = {workspace = "notes", strategy = "nested"}}, -- Enable the notes
        ["core.norg.completion"] = { config = { engine = "nvim-cmp" } }, -- We current support nvim-compe and nvim-cmp only
        ["core.norg.concealer"] = {
            config = {
                icon_preset = "diamond",
                markup_preset = "dimmed",
            }, -- Allows for use of icons
        },
        ["core.norg.qol.toc"] = {},
        ["core.keybinds"] = { -- Configure core.keybinds
            config = {
                default_keybinds = true, -- Generate the default keybinds
                neorg_leader = Keys.norgleader(""), -- This is the default if unspecified
                hook = function(keybinds)
                    keybinds.map("norg", "n", Keys.telescopeleader("l"), "core.integrations.telescope.find_linkable")
                    keybinds.map("norg", "i", Keys.C("l"), "core.integrations.telescope.insert_link")
                end,
            },
        },
        ["core.norg.dirman"] = { -- Manage your directories with Neorg
            config = {
                workspaces = {
                    home = "~/neorg",
                    -- personal = "~/neorg/personal",
                    -- work = "~/neorg/work",
                    notes = "~/neorg/notes",
                    recipes = "~/neorg/notes/recipes",
                    example_gtd = "~/example_workspaces/gtd",
                    rtd = "~/tasq/realtime-deferment/src/functions/realtime/",
                },
                index = "index.norg",
                --[[ autodetect = true,
          autochdir = false, ]]
            },
        },
    },
})

Actual behavior

Export does not work with the @math tag

Expected behavior

math is exported or it works

Steps to reproduce

add


@math 
i = 1
@end
to a file, then export it!

### Potentially conflicting plugins

_No response_

### Other information

it is definitely the math thing!

### Help

No

### Implementation help

_No response_
vhyrro commented 2 years ago

Heyo! This should now be supported through the mathematics extension. It's bundled by default if you load the exporter will all extensions:

["core.export.markdown"] = {
    config = {
        extensions = "all",
    }
},

Lemme know if it works as intended :P

esquires commented 2 years ago

I am getting an error with extensions set to all for the above norg file with

@math 
i = 1
@end

. Here is the traceback:

Error executing vim.schedule lua callback: .../neorg/lua/neorg/modules/core/export/markdown/module.lua:340: attempt to index a nil value                                                                    
stack traceback:
        .../neorg/lua/neorg/modules/core/export/markdown/module.lua:340: in function 'recollector'
        ...ker/start/neorg/lua/neorg/modules/core/export/module.lua:126: in function 'descend'
        ...ker/start/neorg/lua/neorg/modules/core/export/module.lua:116: in function 'descend'
        ...ker/start/neorg/lua/neorg/modules/core/export/module.lua:130: in function 'export'
        ...ker/start/neorg/lua/neorg/modules/core/export/module.lua:138: in function 'on_event'
        ...e/nvim/site/pack/packer/start/neorg/lua/neorg/events.lua:159: in function <...e/nvim/site/pack/packer/start/neorg/lua/neorg/events.lua:146>

In neorg/modules/core/export/markdown/module.lua, here is the value of output (the input to the function ranged_tag that seems to be missing some information:

{ "i = 1\n" }
vhyrro commented 2 years ago

@esquires that's odd, it exports fine on my machine. Are you sure you're on the latest Neorg version and also the latest TS parser version? I believe I fixed something in TS first before the maths export was possible, so make sure it's not a problem there.

If the issue still persists then as always lemme know :)

esquires commented 2 years ago

Thanks! I updated yesterday but it looks like some more commits came in today to fix it. Sorry about that! It is working fine now.

vhyrro commented 2 years ago

Ay! Glad to hear that! I'll close this issue for now since it seems to be fine. Davey can reopen if anything is wrong.

josephsdavid commented 2 years ago

Nice work !!