-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Journal TOC generation does no add the title #780
Comments
Hello,
It is not required. By default, it's the name of the file that is taken. |
Hi, thanks for taking this up. Yes, the problem persists. I just tried again and instead of using @document.meta, it always uses the filename (here: the day). And looking at the entries (vim.inspect(..), I can see that toc_format already receives the entries without the metadata. Maybe I need to configure an additional module or install something? |
Maybe it's a treesitter problem. For the meta tag above, I get
and in the documentation, I find this without any "verbatim" update: I just checked and treestiier claims to have successfully installed the norg_meta parser I think the problem must somehow be with the get_title() function. I'm not too experienced with lua/neovim development, but - how can I run something like |
Hello, you can use the
I'm still not able to reproduce your issue.. Make sure you're on latest neorg version and latest parsers. |
update:
was returned. Despite the fact that empty fields seem to break this somehow, the title is filled correctly.
Now I'm out of ideas... |
Could this be an issue?
|
Oh yes maybe, I recommend deleting this temp folder + the so files, and run To search for the so files: find ~/.local/share/nvim -name "*norg*.so"
# /Users/danymat/.local/share/nvim/lazy/nvim-treesitter/parser/norg_meta.so
# /Users/danymat/.local/share/nvim/lazy/nvim-treesitter/parser/norg.so |
[nvim-treesitter] [1/3] Treesitter parser for norg_meta has been installed |
I'm on a MacBook here with the suggested settings for treesitter:
|
Could you print the output of |
Interestingly enough, it worked once, i.e. the title for the two nodes with metadata was added correctly once, but a subsequent repetition of the same command again only returned the filename. |
@vhyrro maybe totally off, but isn't this a consequence of vim.schedule not working properly ? |
============================================================================== Installation ~
OS Info: Parser/Features H L F I J
|
checked again after running sync-parsers again, which - this time - did not error out.
but the toc has not changed |
It works the first time I enter the toc buffer, i.e. not having it open, then I thought it might be due to treesitter lazy loading, but removing @danymat maybe you can reproduce, but only ever ran it once? |
Hello @svenXY, seems like it's still working on my end (cannot reproduce). The only thing left for me to debug is to provide me a minimal config so that I can reproduce on my end |
@svenXY, by the way, are you on latest neorg ? |
I've experienced the same issue on my setup, it's a major frustration as without the title, the TOC linking doesn't seem to work, going instead to a 404 buffer. Digging into it a little bit, running the following line when I'm in one of my .norg journal files returns the document.meta key/value pairs correctly: print(vim.inspect(neorg.modules.get_module("core.integrations.treesitter").get_document_metadata(0))) After opening the print(vim.fn.bufadd('2023-04-03.norg'))
print(vim.inspect(neorg.modules.get_module("core.integrations.treesitter").get_document_metadata(bufnr))) Where the file name is a file that is in the same directory as the However, running If I run Adding a
Each of the buffers returns the following table as the
Maybe we need to schedule the bufadd and the treesitter query in separate Lua schedule functions? It's almost like tree sitter needs an extra tick to process the file that it doesn't get when we add the buffer and try to parse it in the same Lua function. No idea if that mental model is correct, but will try to replicate soon. This is a real blocker for me adopting neorg for my journaling/task tracking. |
I was able to accurately recreate the issue using this repo (linked below) - rather than pulling the title from the document.meta, it just populated the day of the month that the file was created (e.g. [8]) https://github.com/quentin-fox/neorg-issue You should be able to run Lmk if there are any issues with it! The first time that the script loads up nvim, it'll have a bunch of issues, but the second time it should load up fine. |
Problem: 'get_title()' isn't able to retrieve the meta title correctly, because the journal entry buffer is opened with an incorrect path. Solution: Expand the journal entry path correctly.
Prerequisites
0.0.12
tag or the latest compiled Neovim versionNeovim Version
NVIM v0.9.0-dev-2154+g89722ddfa-dirty
Neorg setup
Actual behavior
I just added
at the top of a journal entry, but it did not add the title but kept adding the day as the title.
The entry is always:
{ 2023, 3, 17, "{:$/journal/2023/03/17:}", "17" }
Expected behavior
The entry should then be:
{ 2023, 3, 17, "{:$/journal/2023/03/17:}", "foobarbaz" }
as then create_toc() would properly set the document title as the link name.
Steps to reproduce
:Neorg journal today
add a @document.meta tag to the journal entry
:Neorg journal toc update
Potentially conflicting plugins
No response
Other information
The documentation does not mention that adding the document.meta is required.
Furthermore, it would be great if there could be some means as to read the title from the first line (or first heading) of the file.
Help
Well, I'm new to lua and would need a lot of help, but willing to help if I can
Implementation help
No response
The text was updated successfully, but these errors were encountered: