How to browse your notes so that Org-Mode elements render in an appealing way?

Dear Org-Roam Discourse,

When I browse my notes I do so within Emacs, looking at the Org-Mode presentation (so there are line-numbers visible, the Org-Elements are included (e.g. #+BEGIN_QUOTE
blah blah blah
#+END_QUOTE

If I want it to render in a nice way, I will push my notes to GitHub, and browse it on there, which looks lovely, but the problem then is:

  1. Losing access to the backlink buffer
  2. being unable to make quick changes

Are there any tools that can make the Org-Mode emacs presentation a bit less of an eye-sore? Or alternatively, what would be the best setup to that allows me to switch between an HTML exported version of Org (like you see on Github) but preserves the backlink buffer and also ideally facilitates quickly flitting back to make edits?

Dear @lex,

You should check the org-roam-server package. It is being developed exactly for the features you’ve described.

How does it work exactly? I have looked at the github repo for the package and seems to be a way to visualise the graph, and jump to the .org file on click? Is that about right or are there more features I haven’t picked up on?

Yeah, seeing all that meta-info is a bit like looking at raw html instead of a rendered web page. It’s distracting and gets in the way of what you’re interested in: your captured thoughts.

At least property drawers – prominent in the upcoming V2 – can be hidden if you add a bit of code to your emacs config file. @nobiot has collected a couple examples here.

They should work on either org-roam v1 or v2, and could be extended to hide other meta-info.

I don’t like seeing the property drawers either, and had considered using the referred-to-code before, but hadn’t until this post encouraged me to. I used the second set of code referenced, since I like that it has a toggle function already written. But when I use it, it is somehow very slightly off. Here’s my before"

Screen Shot 2021-04-02 at 10.59.56 AM

and after

Screen Shot 2021-04-02 at 11.00.08 AM

Hiding a drawer causes the headline below to not indent correctly (the line above pre-test is also a headline with a property)

Does anyone else see this same behavior when using that second bit of code?

@scotto, after clicking through I found that perhaps you wrote this code, if it works for you, what information about my setup do you think might be helpful in my figuring out why it doesn’t work for me?

Try adding a blank line after the property drawer?
Alernatively, the display overlay/text property can be set with using format function, like so:

(overlay-put ov_this 'display (format "\n"))

I just tried with text properties and works. It should be the same for overlay.

Could you please confirm this works on your end, perhaps?

@lex, Org-roam-server has a file viewer feature for notes – it renders a Org file and its backlink buffer in html in your browser.

You can see a demo in the animated GIF in their official GitHub repo (towards the end of animation cycle).

That does fix the problem, but now there’s a blank line in both visible and invisible modes that I don’t want there either

Screen Shot 2021-04-02 at 11.57.17 AM

Screen Shot 2021-04-02 at 11.57.28 AM

I’ll try your second suggestion too, but haven’t yet. Thank you @nobiot!

If that’s not what you going for,
(overlay-put ov_this 'invisible t)
seems to make the line invisible without adding an extra line.

oh thats quite neat, i didnt realise the animation continued past showing off the note graph… yeah that is exactly what i had in mind tbh

Neither of the overlays worked for me. But I don’t know the first thing about how overlays are supposed to work, so I am unable to comment intelligently on what might be wrong.

Here’s what I was hoping for, please tell me if this is reasonable, before hiding:

Screen Shot 2021-04-02 at 2.26.43 PM

after hiding:

Screen Shot 2021-04-02 at 2.27.08 PM

Thanks again for your help with this

@gcoladon, yup that was me, but I can’t reproduce what you’re seeing. Could you post your example org file?

@gcoladon

Did you use my snippets in the following way?

The snippet is meant to be used for the overlay function that @scott shared with us (collected in the wiki as above).

(defun org-hide-properties ()
  "Hide all org-mode headline property drawers in buffer. Could be slow if buffer has a lot of overlays."
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward
            "^ *:properties:\n\\( *:.+?:.*\n\\)+ *:end:\n" nil t)
      (let ((ov_this (make-overlay (match-beginning 0) (match-end 0))))
        (overlay-put ov_this 'invisible t) ;<<<<<<<<<<<<<<<<< This is replaced
        (overlay-put ov_this 'hidden-prop-drawer t)))))

Just to throw it in as an alternative, you could try impatient-mode using an org-export filter. e.g. Reddit - Dive into anything With an org-export-preprocessor to add in your backlinks, e.g. publish.el · master · Neil M / commonplace · GitLab

That said - probably simpler to use org-roam-server :slight_smile:

2 Likes

@nobiot, How did you make your screen recording? I made .MOV on my mac using Command-Shift-5 but discourse wouldn’t let me upload it. But I uploaded it here. Though I prefer your method, especially since it wouldn’t betray how hard I’m hitting the keys on my keyboard :rofl:

For me, the hiding only works when I have content under a headline. But yours seems to work without what @nobiot?

It’s an animated GIF; I use an application called LICEcap.

I have no idea why your Emacs behaves differently. My guess is that you use Doom and there is something somewhere in Doom that influences this behavour—I find Doom very hard to support if you are not using it.

My Org version is 9.4.5, which might have something to do with the difference.

… But… It’s rather hypothetical a situation, isn’t it? You would usually have content if you want to assign an ID to a headline. So… Perhaps you don’t really need to resolve this issue.

EDIT.
Alternatively, maybe it’s because I don’t use org-indent-mode to indent headlines according to their levels—headlines are always displayed at the beginning of the line. Your screen shows that level 2 headlines are indented—I assume you are using org-indent-mode, which I believe is a default for Doom.

Its a pretty common case for me, but I am not experienced enough to know if my workflow is pathological. In my Weekly file at work (I prefer weekly files to daily files, they seem less disjointed to me, and I think of work days as naturally grouped into weeks), I take stream of consciousness notes during meetings under a headline there, but then refine them and transfer them to a headline inside the various projects they belong to, and when I link from that headline in the Weekly file to the headline in the Project file, org-roam creates an ID under the Weekly headline.