selimrbd / py-obsidianmd

Python interface to your Obsidian notes
BSD 3-Clause "New" or "Revised" License
262 stars 21 forks source link

Tags do not get transferred well when converting from inline to frontmatter (obsidian 1.4 properties update) #30

Open kiithy opened 1 year ago

kiithy commented 1 year ago

Description of problem

Obsidian note before usage of code image

Obsidian note after usage of code image

Code used

from pathlib import Path
from pyomd import Notes, Note
from pyomd.metadata import MetadataType

path_dir = Path("/path/to/directory/file")
note = Note(path_dir)

note.metadata.move(fr=MetadataType.INLINE, to=MetadataType.FRONTMATTER)
note.update_content(inline_inplace=False , inline_position="top" , inline_tml="standard")  #type: ignore
note.write()

Extra Issue

Syavash-kazemi commented 11 months ago

@kiithy , what about your links? Are they moved properly for you? I think we are missing double quotation to wrap the links.

Syavash-kazemi commented 11 months ago

If you only have issues on tags, and you only use them in properties, there is a workaround. You could find and replace (#tag_name to tag_name). Another alternative is using a community plugin called "Linter". It will fix it automatically.

kiithy commented 10 months ago

@kiithy , what about your links? Are they moved properly for you? I think we are missing double quotation to wrap the links.

@Syavash-kazemi As of the day I tried, they do not work as they made a link that was originally [[this link]] become [["this link"]] which is causing the link to not work. I also have not tested the functionality such that when it has more than one comma separated link, the code is able to detect and transfer it as a List type instead of just a Text type.