nvim-neorg / neorg

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

Relative links are badly converted to markdown (only works correctly for {:file:* heading:}) #1491

Open TymekBrunka opened 3 months ago

TymekBrunka commented 3 months ago

Prerequisites

Neovim Version

NVIM v0.10.0 (i have updated today and issue still exists (not big surprise))

Neorg setup

{
    "vhyrro/luarocks.nvim",
    priority = 1000, -- We'd like this plugin to load first out of the rest
    config = true,   -- This automatically runs `require("luarocks-nvim").setup()`
},
-- {
--     "champignoom/norg-pandoc",
--     branch = "neorg-plugin",
--     config = true,
-- },
{
    "nvim-neorg/neorg",
    dependencies = { "luarocks.nvim",
        { "nvim-lua/plenary.nvim" },
        { "laher/neorg-exec" },
        { "nvim-neorg/neorg-telescope" }
    },
    config = function()
        require("neorg").setup {
            load = {
                ["core.defaults"] = {},
                ["core.export"] = {},           -- export to md
                ["core.promo"] = {},            -- manage indent
                ["core.concealer"] = {
                    config = {                  -- We added a `config` table!
                        icon_preset = "varied", -- And we set our option here.
                    },
                },
                ["core.tangle"] = {},          -- Add tangling support
                ["core.esupports.metagen"] = { -- Automatically sync document meta
                    config = {
                        type = "auto",
                    }
                },
                ["core.dirman"] = {
                    config = {
                        workspaces = {
                            notes = "~/notes",
                        },
                        default_workspace = "notes",
                    },
                },
                ["core.presenter"] = {
                    config = {
                        zen_mode = "zen-mode",
                    },
                },
                --integrating?
                ["core.completion"] = {
                    config = {
                        engine = "nvim-cmp",
                    }
                },
                ["core.integrations.nvim-cmp"] = {},
                -- ["external.pandoc"] = {},
                ["core.integrations.telescope"] = {},
                ["external.exec"] = {
                    config = {
                        default_metadata = {
                            out = "virtual"
                        },
                        lang_cmds = {
                            cpp = {
                                cmd = "g++ ${0} && ./a.out && rm ./a.out",
                                type = "compiled",
                                main_wrap = [[
                                #include <iostream>
                                int main() {
                                    ${1}
                                }
                                ]],
                            },
                        }
                    }
                },
            },
        }

        vim.wo.foldlevel = 99
        vim.wo.conceallevel = 2
    end,
},

Actual behavior

so i try both ways i know how to insert link to relative path (and first and second one point to heading)

** {:$/syntax:** hi}[neorg syntax]
** {:syntax:** hi}[neorg syntax]
** {:syntax:}[neorg syntax]

(file exists, works fine in neorg)

but when converting to markdown with example command: :Neorg export directory /home/tymek/notes markdown ./norg and opening ./norg/index.norg the links look like this

## [neorg syntax]($/syntax.md#hi)

## [neorg syntax](syntax.md#hi)

## [neorg syntax](#syntaxmd)

Expected behavior

idk, maybe working links

Steps to reproduce

what should i type here?

Potentially conflicting plugins

none, i guess, obsidian.nvim only works for .md files

Other information

also sometimes when opening link in .norg file to .norg file it opens that other .norg file with filetype=

Help (can i help with code)

No

Implementation help

No response

benlubas commented 3 months ago

That markdown exporter is, as you've noticed, not that great. There are other ways to export to markdown that should yield better results. Those methods are described here in Pysan's tutorial, and I'd like to emphasize that each method has it's flaws currently.

Currently there's work being done on a new parser for norg, after that's done, proper markdown import/export via pandoc should come not too long after :crossed_fingers:

TymekBrunka commented 3 months ago

good, i will stick to {:file:*header} syntax as it exports it correctly and hope that neorg exporter will get better.

thank you for info

(i will leave this issue open)