Skip to content
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

Add option to prefix links with filename before anchor tag #2

Merged
merged 1 commit into from
Jul 31, 2018

Conversation

dakra
Copy link
Contributor

@dakra dakra commented Jul 31, 2018

I use org-make-toc for my Emacs config which is pretty big
and having init.org always display everything on the main github page would
be too heavy. Therefore I just render a README.org with a table of contents that points
to the init.org file.

This PR adds option to prefix the links with the filename so I can
copy&paste it from my init.org to the readme.

I first thought about making it in a way that doesn't involve me
copy and pasting but then figured I don't update the sections that
often and it's a very simple solution.

@alphapapa
Copy link
Owner

Hi Daniel,

Thanks, that is a very simple solution. However, I think it wouldn't take much to add support for ToCs of contents in other files. Would you prefer that? I think I could add it without much trouble.

@alphapapa alphapapa self-assigned this Jul 31, 2018
@dakra
Copy link
Contributor Author

dakra commented Jul 31, 2018

@alphapapa I even thought (briefly) about adding another
org property (TOC_DESTINATION? or the other way around
TOC_SOURCE?) but found it not too intuitive.
Then I started just another command org-make-toc-other-file
but saw it's a bit more complicated than I thought and
just went with this very simple approach.

But long story short, yes, I would like very much
if you implement that.
(Also use file-relative-name in case source/destination
is in a different directory? Not sure if that even works
in Github)

Thanks!

@alphapapa
Copy link
Owner

I think you were right in the first place. I started to work on the idea and now I realize that it's not as simple as it seemed. This is mainly because we support multiple ToC's in a single file, so there isn't exactly a "ToC for a file" (although the all setting could be like one, but that would be giving up useful features).

To fix that we'd have to not only specify a file but a heading from which to act in the file. We could certainly do that, by specifying an Org outline path, but I'm not sure if that complexity is worth it. I saved my WIP in a feature branch, but for now I think I will just merge your PR.

@alphapapa alphapapa merged commit 710dcf9 into alphapapa:master Jul 31, 2018
@dakra
Copy link
Contributor Author

dakra commented Jul 31, 2018

Thanks.

I don't think this is a feature that many people need,
so it's not really worth to spend too much time on it
if it's not easy and simple to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants