In org mode, when you generate links from code blocks:
#+begin_src shell :results output
for f in *; do
if [[ "$f" == "index.org" ]]; then
continue
fi
printf -- "- [[file:$f][$f]]\n"
done
#+end_src
#+RESULTS:
: - link_one
: - link_two
: - link_three
Even though they don't "expand" (shown in the format [[file:link_one][link_one]]), you still cannot interact with them in emacs as links.
For clarification, I am trying to use this on an index page to automaticlly link in all the other pages in that directory. I think it would look cool to do this from org mode natively instead of writing a script to do it, and it's a more elegant solution.
This first problem can be solved by deleting the colons in the results block, but that is a pain.
Furthermore, so long as the #+RESULTS: block is there, exporting to html does not recognize the links and instead opts to display them as plaintext, even though emacs (the editor ) "understands" that they should be links when you delete all the colons at the front of the links. In other words: the html export function doesn't recognize them as links, even though emacs does. My question is: how can you generate links from code blocks such that they are recognized by the exporter and by emacs automatically?
I've tried looking around but it's a very niche problem. There are ways to get links from code blocks, but they involve writing all the output to a file, which is not what I want. Maybe there is some hack where I can make it work by using that?
I've found the answer. Basically another post had a similar (but not the same)
problem, and their solution was to use :results output raw
instead, which
almost worked. You also need to add :exports both
in order for the exporter to recognize the output of the code blocks.