arnau / obsidian-metatable

An Obsidian plugin to display the frontmatter section as a fully expanded table.
MIT License
150 stars 13 forks source link

[Feature Request] Hide metadata that is empty. Support Obsidian/Evernote links #5

Closed dinhngocvuong closed 3 years ago

dinhngocvuong commented 3 years ago

Hi! First of all thank you for this plugin! I have 3 requests:

  1. Could you add an option to hide metadate that is empty

  2. Suport Obsidian, Evernote links... Set the max length of URL

  3. When I click the tag, the windows popup always open instead of search

Thank you!

arnau commented 3 years ago

Hi @dinhngocvuong, thanks for all the feedback!

Could you add an option to hide metadate that is empty

Next release will include a toggle in settings to ignore members with null (empty) values.

Suport Obsidian, Evernote links... Set the max length of URL

I need to look into this. I'm not familiar with Evernote or any obsidian plugin that handles this kind of plugin. Do you have any pointers? It might be a similar issue I have with #3

When I click the tag, the windows popup always open instead of search

ugh that's not good. Unfortunately I don't have access to any Windows machine to test this behaviour.

I did a change (next release) in hope it will fix it but it's a blind shot :S

dinhngocvuong commented 3 years ago

I just upgraded to v0.7.0 and see most my above issues were fixed. Thanks a lot!

The Evernote link is similar to Obsidian link on #3

1 more question: How can I change the tag style like Imgur I cannot override your plugin style

And I prefer the sign "#" before the tag name.

arnau commented 3 years ago

Glad to hear!

I'm still looking into the evernote ones, should be straightforward but I don't want to add something without testing at all :)

At the moment you can't change the tag styles I'm afraid (nor add the # in front of it), it's one of the consequences of having strong boundaries for the plugin. That said, I'm thinking in how could it be done though

arnau commented 3 years ago

Out of curiosity, what custom code do you use to have tags with different colours?

dinhngocvuong commented 3 years ago

You can check it out https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/13

arnau commented 3 years ago

So, the latest version should create links for Evernote and a custom property so you can add your own prefix for tags. E.g.

/* <your vault>/.obsidian/snippets/metatable.css */
.obsidian-metatable {
  --metatable-tag-symbol: "#";
}
dinhngocvuong commented 3 years ago

Great! Thank you for your help.

arnau commented 3 years ago

Hi @dinhngocvuong , I'm happy to say that with the new version 0.8.0, tag customisation is posslbe! Thanks for raising the issue, it has helped me learn a few bits :)

So, once you update the plugin you'll be able to do the following:

/* <your vault>/.obsidian/snippets/metatable.css */

.obsidian-metatable {
  --metatable-tag-symbol: "#";
}

.obsidian-metatable::part(tag) {
  background-color: pink;
}

.obsidian-metatable::part(tag warning) {
  color: white;
  background-color: gold;
}

.obsidian-metatable::part(tag danger) {
  color: white;
  background-color: red;
}

.obsidian-metatable::part(tag success) {
  color: black;
  background-color: limegreen;
}

Notice that the value that you have to use is the actual tag. Based on your screenshot it would be default, warning, success and danger.

Finally, and this is the reason for 0.8.1, if you have spaces in your tags (which I don't recommend) spaces are percent-encoded so a tag such as very dangerous would require a rule such as:

.obsidian-metatable::part(tag very%20dangerous) {
  color: yellow;
  background-color: red;
}
dinhngocvuong commented 3 years ago

I always start my note template with metadata, but some quick notes don't need the metadata, and I want to hide the text "Metadata" on preview page when there is nothing to show.

arnau commented 3 years ago

Umm, I fixed this case around version 0.8. I can certainly not reproduce it now. I'm testing with a clean obsidian vault with metatable 0.8.1 installed and nothing else.

Could you give me some details of version of Obsidian and metatable version please?

dinhngocvuong commented 3 years ago

I use Obsidian 0.12.3 for Windows 10, Metatable 0.8.1

Code view

Preview view

Setting

arnau commented 3 years ago

Ah, thanks. Will look into this case soon

arnau commented 3 years ago

Ok, version 0.8.2 fixes this case where all top-level keys are null πŸ‘

arnau commented 3 years ago

Something to note though is that it won't work if you have nested nulls, e.g.:

top:
  child:

Because top is technically not null even though that after pruning child because it's null, then top becomes null.

For now I'll keep it as a no-fix mainly because it would require a fairly expensive rework.

dinhngocvuong commented 3 years ago

Could you please fix for the case: Ignored keys

In my case, I put cssclass to Ignored keys

Code view

Preview view

arnau commented 3 years ago

Fixed πŸ˜… in 0.8.3 (when GitHub Actions comes back to live…)

dinhngocvuong commented 3 years ago

Thank you for the quick fix! πŸ‘