-
Notifications
You must be signed in to change notification settings - Fork 131
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
Support :target attribute for #+toc keyword #393
Comments
Hello, I will review how ox-html supports the |
Hello, the issue is auto-closed as I linked it to the commit implementing this feature. But feel free to comment here if the TOC :target is not working for you. You can find the ox-hugo test added for this feature in 082f229. The ox-hugo exported Markdown is here and the Hugo rendered output of that test is on https://ox-hugo.scripter.co/test/posts/toc-target/ . |
Strangely, still not working on my end. I updated my ox-hugo installation to version 20200911.453 through MELPA. I confirmed that the new |
ox-hugo test suite is passing. So it's certainly working in the remote environment on Travis CI. Unfortunately I cannot help fix this if I cannot reproduce the issue locally. I will leave this issue open until you have figured it out. |
Still working on troubleshooting... the error I get now is different from the OP. Now, the error is:
Strangely, it still works fine on regular org-export to HTML. Below is my full org-mode file:
|
Hello, Sorry for the late reply, but I just found some time to look into this. The reason your example won't export is that you are trying to inject the toc from a different export scope (different post subtree) into the current export scope. You have:
When I try to export the "chapter-2" post, I see this error, which I expect:
It's because the Org exporter "looks" only within the scope of that subtree and it's unable to find the
You will get the same error with HTML export as well. Try putting the point somewhere in the What does this mean? It's a limitation of the Org exporter and we cannot export one subtree which has references outside the scope of that. So this request cannot be supported by ox-hugo. You should be able to work this out using a custom Hugo shortcode or page template though. You can call a shortcode to inject a TOC from a different page (chapter 1 in your example). Reach out on the Hugo Discourse forum for help on this. I'll close this issue as the basic toc :target feature works when the target is in the current export scope. While the issue is closed, you can still comment and we can continue the discussion if you are still interested in this. |
Actual Behavior
To place a TOC at a specific location, I inserted:
#+toc: headlines 3 :target #reading-material
It produces the expected behavior when I use
org-export
to produce HTML.However, when I use
ox-hugo
, the Message buffer shows the following error when it reaches the subtree containing the#+toc: ....
statement:org-hugo-keyword: Wrong type argument: char-or-string-p, nil
Expected Behavior
How to Reproduce the Issue
Below is a simplified version of the org file:
Example Org File
Generated Markdown File or Error
Ox-Hugo Debug Information
Debug Info
The text was updated successfully, but these errors were encountered: