Show raw YAML in live preview (with hidden properties)

Use case or problem

Even when the “Show file properties” option is turned off, I can no longer see my YAML in live preview.

Proposed solution

Allow an option where properties are off and YAML is restored.

Current workaround (optional)

YAML is visible in source mode (but it is inconvenient to switch back and forth as simultaneously viewing YAML, images, and dataview queries are integral to my workflow). Perhaps it could alternatively be restored through CSS or a plugin, but I am unfamiliar.

29 Likes

I think it’d be smooth to be able to arrow-up into showing the literal yaml directly, like with other live-preview rendered things, which you arrow-key into to edit.

9 Likes

I also tend to agree with this, as it maintains consistency with other markdown syntax.

2 Likes

I would also like this; properties completely broke a key workflow of mine. I had an item in my YAML front matter of the format ‘review: ’. I wrote a Keyboard Maestro script that (among other things) would search the current window for ‘review:’ then the automatically enter the keyboard commands that would get the entire line highlighted and replace it with the current date. Search won’t let me do that now because I can’t get it to highlight the entire line. (Looking at alternatives including just pulling that out of the front matter area; haven’t had time to play yet). But in the meantime my KM review script is broken…

Properties seems like they might be interesting but the concept is sliding further away from ‘Obsidian is a way to handle a bunch of markdown files’. There’s now an abstraction layer in front. Of course, YAML stuff in front isn’t really markdown either, I guess.

3 Likes

I use pandoc to compile my files to pdf, in my yaml I can have the hierarchical properties and long strings (like abstracts or latex import to insert into preamble), having a possibility to turning off the properties view without switching to source view would improve my work with these kind of files

---
title: The document title
author:
- name: Author One
  affiliation: University of Somewhere
- name: Author Two
  affiliation: University of Nowhere
abstract: |
  This is the abstract.

  It consists of two paragraphs.
---

# Introduction

Lorem ipsum some text

Another example

---
title: Test
author: Author Name
header-includes: |
    \usepackage{fancyhdr}
    \pagestyle{fancy}
    \fancyhead[CO,CE]{This is fancy}
    \fancyfoot[CO,CE]{So is this}
    \fancyfoot[LE,RO]{\thepage}
abstract: This is a pandoc test . . . 
---

# This is a test

Lorem ipsum....

And one more

output:
  pdf_document:
    latex_engine: xelatex
    fig_caption: yes
    keep_tex: true
    template: template.tex
  html_document:
    df_print: paged
titlefromtex: The Title
periodfromtex: The Period
versionfromtex: The Version
descriptionfromtex: The Description

For vim users, the properties component gets in the way especially as custom vim mode keymapings are ignored when the component has focus.
For vim power users, a custom form UI is never going to be as efficient as just editing the raw YAML.

I have to drop out of LP to source mode often when previously I could seamlessly edit in LP, and I want the option to turn off the properties component in LP.

5 Likes

Do you have particular reason why do you use Obsidian as an agent in your scripts? Would it be more effective to use command line tools in your script to access your files?

We need to understand the why behind this feature request and try to address as many of them as possible

You can use arrow keys to move among properties. In general the properties UI, is keyboard accessible (esc, tabbing, selection)

Separate FR:
https://forum.obsidian.md/t/properties-support-multi-level-yaml-nested-attributes/63826

Except not really. It has its own separate set of keybindings that pre-empts Obsidian hotkeys and .vimrc bindings (window management, vim mode undo/redo, etc).

We need to understand the why behind this feature request and try to address as many of them as possible

For myself, backlink support in yaml metadata is great and a welcome addition. But I have no need for the properties editor and would just like the text back without having to toggle back and forth from source mode. :person_shrugging:

5 Likes

I agree with this suggestion - I think the Properties UI is great, but I want Properties to be part of the note, just as tables, callouts, code blocks, and HTML are, and I want to edit it as text once the cursor is in that area.

Some say that source mode should be used, but I would like to continue using the Live Preview mode if possible, as the delicate balance between display and editing in the Live Preview mode is one of the reasons Obsidian is superior to other tools.

8 Likes

The notes for Datacore say:

Obsidian is adding support for new frontmatter and YAML (…) Inline YAML. You will be able to place YAML objects anywhere in the document and mark it inline to have it add additional metadata to the page / section.

  1. Perhaps this explains why YAML can’t be seen in Live Preview if it is no longer going to be limited to being at the top of the file as a single block?
  2. Is inline YAML (without using double colons) already available in 1.4.1?

(Not an insider, so I have no access to 1.4.1 as yet. Loads of ignorance over here.)

i understand that adding another view/feature adds more complexity to codebase to develop and also maintain later, and in general the properties view is a good future direction into enhancing accessibility and easy of use for most of users; So I understand that the devs might need to learn where to put their attention and what benefit the most of community …

I subjectively prefer directly editing yaml metadata as a part of note, especially in more complex cases, as the additional steps/workarounds are breaking the plain text editing experience™ which is a part of magic of Obsidian for me; live preview was a sweet balance (and the advantage that Obsidian has over VSCode or other editors that I use to work with markdown-type family of files), I can switch to source view when needed or use properties editor when there will be a hierarchical properties implemented, but it would be great to have a choice over enabling new feature;
(while in the same time i understand it can be more beneficial for the community if the devs prioritize some other feature)

Also in live preview, after the initial creation ( when the yaml header exists), properties can be added only one by one and I cannot paste any properties as key : values into yaml (the source view could be used for that as a workaround)

Comment aren’t visible in yaml (which is good, but in general when working with more complex metadata this is another argument for switching to source view); in general I just think that pandoc metadata variables aren’t conceptually the same thing as Obsidian page/note properties, even if they might be represented in the exactly same way, and editing them in a old way as a block just suits me better to my mental model of it (but this is a personal preference);

2 Likes

Maybe there could just be a command to toggle show/hide YAML :man_shrugging:

1 Like

The whole thread is to show a usecase for it (by it I mean toggling between new properties view and YAML block view, while still being in the live preview mode)

Ok, point taken.

1 Like

There are two suggestions in this thread.

  1. render properties but show source when focused similar to how LP does with tables. That feels like a separate feature request.
  2. bring back text YAML front-matter in LP as we have in 1.3.x

I’d be happy with 1, but 2 is ideal for me and the original FR in this thread.

The push-back for not supporting source YAML in LP seems to be the Obsidian team wants to understand all the use cases and improve the properties component rather than support what already existed in 1.3.x.

For myself, the use case is: something I don’t need is replacing something I was pretty happy with already. That is, something that worked fine in 1.3.x is getting taken away.

9 Likes

As I see it, the problem is that the Properties interface is fine for a sidebar or floating operation – but it doesn’t belong in Live Edit. It’s essentially a very different mode of interaction than editing text, which is what I came to do if I’m in that mode.

Structurally ideally, there should probably be an option in the Edit Settings which allows you to turn off Properties as currently presented in Live Edit, showing YAML directly and allowing you to edit it as such.

It really does break the modality of the interface, both in presentation and operation. It’s a bad idea.

I love having a Properties tab that I can plop somewhere if I feel like I need to make broader changes or want to have something specific – but I don’t need it. And I definitely don’t need it in my Edit interface.

There’s always source mode for that.

Also,
Settings->editor->show properties will remove the properties UI from the editor, so it is only available in a sidebar tab.

You can switch to source mode to edit, you can edit with notepad, that’s of course not wrong, but this obviously brings trouble to a considerable number of users. Updates that bring trouble to users are not good updates. The advantage of ob is high customization, everyone can set it up the way they like the most. If 95% of users like a certain option for a feature, only keeping that option would hurt the other 5% of people. Although 5% is a minority, 20 such independent features would hurt 65% of people. ob would become as closed, arrogant and dictatorial as Apple. I don’t want ob to become like that. I don’t want ob to tell users, “Most people like this feature, accept it.” I don’t want ob to tell users, “You can still do something, as long as you click here first, then there, then press a shortcut key, then click the mouse.”

I really like ob, but the recent style makes me afraid. I’m afraid it will cancel the unique features I like and force us to use uniform settings.

3 Likes

I really like the all properties pane like the tags, but would also like to revert to seeing YAML as “source view” in my live preview, as I use dataview and YAML heavily and prefer the plain text.

The properties also tends to add random line breaks, show lists differently or add “” to certain text properties which annoys me when I swap between source view and live preview.

I support this FR. Perhaps when we enable the Properties feature in the core plugins, we could have an option to show as source view or not in the settings?

1 Like