marcusolsson / obsidian-projects

Plain text project planning in Obsidian
Apache License 2.0
1.46k stars 60 forks source link

Support inline attributes #70

Closed chenxin0397 closed 1 year ago

chenxin0397 commented 2 years ago

Show Project can only display this format

---
status: Backlog
due: 2022-11-03
published: false
weight: 45
tags:
- pkm
- obsidian
---

This format cannot be displayed:

status:: Backlog
due:: 2022-11-03
published::false
weight::45
tags::
- pkm
- obsidian
marcusolsson commented 2 years ago

AFAIK, inline attributes is a Dataview-specific syntax. If you have Dataview enabled, you can create projects from Dataview queries. Then you should be able to query the inline attributes. Let me know if not!

chenxin0397 commented 2 years ago

how can i should be able to query the inline attributes.?

chenxin0397 commented 2 years ago

I am indeed using the Dataview plugin, because for a long time some files needed two colons to add YAML content, so now there are nearly 200 files with only this content:

状态:: 已安装
Pid:: obsidian-double-click-tab
类型:: 标签页
日期:: 2022-10-18
tags:: #插件记录
作者:: Boninall
安装版本:: 1.1.2
功能介绍:: 用于在双击选项卡标题(如关闭选项卡)时修改默认行为。
仓库网址:: https://github.com/Quorafind/Obsidian-Double-Click-Tab
aliases:: 双击标签页
我的评价::
删除原因:: 

When I wanted to use the Project plugin for management, I found that the effect was not good, and some Chinese content could not be displayed

marcusolsson commented 2 years ago

Can you share the Dataview query you're using so I can try reproducing the issue?

chenxin0397 commented 2 years ago

This is the effect of Dataview image

---
aliases: 
tags: 管理页面 DW
created: 2022-10-26 10:04:11
modified: 2022-10-26 10:09:40
obsidianUIMode: preview
---

```dataview
table without id
状态,
类型,
file.link as 文件,
Pid as ID, 
日期,
status,
功能介绍
from #插件记录
where !contains(file.name, "模板-插件记录")
sort 日期 desc


and this project
![image](https://user-images.githubusercontent.com/73974352/198284325-e496cd1d-9431-46f3-8af0-44dc2629df44.png)
chenxin0397 commented 2 years ago

Oh, yes, there is one more thing, that is, there seems to be incompatibility in the way tags are written. If there are files in the same project table, it is written like this: tags:

Other files are written like this: tags: pkm obsidian The tags in the project table will only show the latter

before image after image The difference between the two pictures is only to change this content of this file

marcusolsson commented 2 years ago

I added a file called "Issue 70" and created a new project with the query you provided:

CleanShot 2022-10-27 at 14 41 57@2x

CleanShot 2022-10-27 at 14 44 05@2x

It seems to work as intended? Could you confirm that you're enabling Dataview when you create your project?

marcusolsson commented 2 years ago

Regarding the way tags are being displayed.

Each column has a data type. When the plugin reads the files, it tries to detect the data type based on the field values. Currently, if the plugin detects multiple different data types, it falls back to a string field.

In your example, it seems like you have a file that says:

tags:
- pkm
- obsidian

and another that says:

tags: pkm obsidian

Since the tags property has both an array value, and a text value, it falls back to a text field. The reason the other cells are empty is because the plugin doesn't know how to convert the array into a string. In a future version, I'd like to show parsing error in a user-friendly way.

Could you share what you'd expect to happen in this case?

chenxin0397 commented 2 years ago

image Why is my UI content different here?

There is no Dataview option when creating a project? image

chenxin0397 commented 2 years ago

Regarding the way tags are being displayed.

Each column has a data type. When the plugin reads the files, it tries to detect the data type based on the field values. Currently, if the plugin detects multiple different data types, it falls back to a string field.

In your example, it seems like you have a file that says:

tags:
- pkm
- obsidian

and another that says:

tags: pkm obsidian

Since the tags property has both an array value, and a text value, it falls back to a text field. The reason the other cells are empty is because the plugin doesn't know how to convert the array into a string. In a future version, I'd like to show parsing error in a user-friendly way.

Could you share what you'd expect to happen in this case?

I hope that both ways of writing can be displayed. It doesn't matter whether there is a difference in display effect, but it is mainly for the convenience of reading the data content.

marcusolsson commented 2 years ago

Why is my UI content different here?

The Use Dataview should be visible if you've enabled the Dataview plugin in your vault (Settings > Community plugins).

It doesn't matter whether there is a difference in display effect, but it is mainly for the convenience of reading the data content.

Thank you 🙏 I've created #71 to track this issue.

chenxin0397 commented 2 years ago

I seem to figure it out, because there's a little problem - the way I manage plugins is to use the template to call the plugin ID's method to start the plugin in batches.

Refer to the method here: https://tfthacker.medium.com/improve-obsidian-startup-time-on-older-devices-with-the-faststart-script-70a6c590309f My Dataview plugin is in the FastStart-Plugins-ShortDelay list.

The Dataview plugin is automatically opened every time the OB starts, but the problem you said still exists. I've noticed similar issues with other plugins as well. It needs to be closed and reopened manually. The problem has been solved. Chinese forums say this is called (original state). The way I start the Dataview is not in the original state.

Above are some clues I provided. Are there any improvements to the plugin?

Anyway, with the launch method I'm using, the Dataview is available. But the plugin attached to the Dataview loses the relevant functionality image

chenxin0397 commented 2 years ago

image image

jsmm commented 1 year ago

Hi. I think the error I get is related to the one in this thread. YAMLParseError: Implicit map keys need to be followed by map values at line 4, column 1: tags - lectura ^^^^^^^

I can't understand the message nor find the offending file(s). Tags are written in YAML front matter in new lines after two spaces and hyphen, as in:

tags:
  - lectura
  - informática

Thanks for sharing your plugin and help.

marcusolsson commented 1 year ago

Closing in favor of #173.