Doc Mode on a per-bullet basis?

Right now, the shortcut td toggles Document Mode for the entire app.

Would the team accept a feature that allows Doc Mode to be set on a per-bullet basis?

I’m imagining it’d be a property on a bullet, something like this:

- this bullet and its children will be shown in Doc Mode even if rest of app is not in Doc Mode
  display-as:: document

I poked around to see if this is already supported and didn’t find anything. If it is, apologies for the spam!

Yes, for sure, we want it too :smiley:

3 Likes

Awesome! Here are some other design decisions I’m considering:

I’ll build it in a way such that it can extensible to other display modes too, e.g.:

- this bullet will be shown in `Numbered List Mode`
  render-mode:: numbered-list
- this bullet will be shown in `Lowercase Lettered List Mode`
  render-mode:: lowercase-lettered-list
- this bullet will be shown in `Uppercase Lettered List Mode`
  render-mode:: lowercase-lettered-list
- this bullet will be shown in `Doc Mode`
  render-mode:: document

To show its direct children in a particular mode, you would add render-mode-children:: [MODE-NAME]. For example:

- this bullet's children will be shown in `Numbered List Mode`
  render-mode-children:: numbered-list
- this bullet **AND** its children will be shown in `Numbered List Mode`
  render-mode:: numbered-list
  render-mode-children:: numbered-list

This would also work to show a whole page in a particular mode, regardless of the global mode setting at the time:

---
title: This is a page
---

render-mode:: document

We could also add hotkeys to toggle the most common modes. I’m thinking of the following hotkeys, inspired somewhat by Google Docs:

  • Cmd7 → toggle Numbered Mode on/off for current page
  • Cmd8 → toggle Doc Mode on/off for current page
  • CmdOpt7 → toggle Numbered Mode on/off for current bullet
  • CmdOpt8 → toggle Doc Mode on/off for current bullet
  • CmdShift7 → toggle Numbered Mode on/off for bullet’s children
  • CmdShift8 → toggle Doc Mode on/off for bullet’s children

Before I start building, I’d love any feedback! Is there a more elegant approach you’d recommend?

2 Likes

Sorry for the late response, your approach looks fantasy!

I haven’t thought about this problem carefully, but I have some questions:

  1. render-mode doesn’t support a collection like [document, numbered-list], right? A block’s children might need to be displayed in both document mode and numbered list mode.
  2. Is there a strong need for specifying the render mode for the block itself instead of its children? Mixed numbered list and lettered List?
  • this bullet AND its children will be shown in Numbered List Mode
    render-mode:: numbered-list
    render-mode-children:: numbered-list

1) render-mode doesn’t support a collection like [document, numbered-list], right? A block’s children might need to be displayed in both document mode and numbered list mode.

I don’t think there’s a need to support a collection. Instead, it would work sort of like CSS specificity. The render mode set by render-mode-children:: would be overridden by children who themselves have a render-mode:: defined on themselves. For example:

- my children will be shown in `Numbered List Mode`
  render-mode-children:: numbered-list
   - I will be rendered as a numbered list, as defined on my parent
   - I will be rendered as a document, because my render mode overrides the mode defined on my parent
     render-mode:: document

Note – I’m not 100% sure I understood what you meant by “collection”, so please let me know if this doesn’t answer your question!

2) Is there a strong need for specifying the render mode for the block itself instead of its children?

That would definitely be more elegant. I’m imagining your proposal would look something like this:

---
render-children-as:: document    // this sets the mode for the top-level bullets
---

- I'll be shown in `Doc Mode`, as defined on the page property
  render-children-as:: numbered-list
  - I'll be shown in `Numbered List Mode`, as defined on parent property
  - I'll be shown in `Numbered List Mode`, as defined on parent property
- I'll be shown in `Doc Mode`, as defined on the page property
  - I'll be shown in `Doc Mode`, inherit from parent's mode since it's not defined
  - I'll be shown in `Doc Mode`, inherit from parent's mode since it's not defined

The problem I see with this is that children would have to have the same mode as their siblings, i.e. you can’t specify a different mode just for one child.

One alternative could be to have the property be render-as:: rather than render-children-as:: and have it apply to the parent AND children, like this:

---
render-children-as:: document    // this sets the mode for the top-level bullets
---

- I'll be shown in `Numbered List Mode`, as defined on myself
  render-as:: numbered-list
  - I'll be shown in `Numbered List Mode`, as defined on parent property
  - I'll be shown in `Numbered List Mode`, as defined on parent property
  - I'll be shown in `Lowercase Lettered Mode`, as defined on myself
    render-as:: lowercase-lettered-list
- I'll be shown in `Doc Mode`, as defined on the page property
  - I'll be shown in `Doc Mode`, inherit from parent's mode since it's not defined
  - I'll be shown in `Doc Mode`, inherit from parent's mode since it's not defined

But that feels odd to me, because I rarely want a parent and its children to have the same mode. It does have the benefit of being more flexible—in theory you could go in and add a different render-as:: to each child to override the parents’ mode, but that ends up being messy.

If we don’t care about being able to set different modes for siblings, then your proposal to just do render-children-as:: works well. It also leaves room to add render-self-as:: in the future.

2 Likes

Thank you for the detailed explanation!

For “collection”, I mean a page or maybe a block can be displayed in both document mode and numbered list mode. For example, a screenshot from roam:
CleanShot 2021-11-15 at 22.59.44

I think

If a different mode is needed for a sibling, your proposal is great!