omnivore-app / logseq-omnivore

Logseq plugin to fetch articles and highlights from Omnivore
MIT License
293 stars 16 forks source link

Configurable template #52

Closed alxlg closed 1 year ago

alxlg commented 2 years ago

Hi, I think it's very important for this plugin to let the user configure what appears in each block, including the properties keys (and maybe that "🔖 Articles" in the parent block). For example, this plugin introduces the property site:: but I already use it in my graphs in another way. Also, many users including me would like to localize their graph in their native language and not being forced to mix it with English terms.

I think the ideal would be to let the user edit a template of imported blocks, that by default would be:

- [<page_title>](<omnivore_ref>)
  site::  [<site_name>](<page_url>)
  author:: <page_author>
  labels:: <labels>
  date-saved:: <date_saved>

For example, I would configure my template to this:

- [<page_title>](<page_url>)
  tags:: <labels>
sywhb commented 2 years ago

Hey @alxlg, this is a great idea and we had thought about adding this feature.

Would you like to configure it in the plugin settings or create a template page in Logseq?

We would also need to validate the template after saving because we are running some Datascript queries to update blocks when syncing with Omnivore.

alxlg commented 2 years ago

@sywhb

Hi, the most intuitive way I can think is three textboxes in plugin settings filled with default template:

  1. Header (leave empty to remove it):
    ## 🔖 Articles
  2. Article:
    [<page_title>](<omnivore_ref>)
    site::  [<site_name>](<page_url>)
    author:: <page_author>
    labels:: <labels>
    date-saved:: <date_saved>
  3. Highlight:
    > <highlight>

And list the available <keys> and their meaning.

Now that I think about it, being able to set the page name (now Omnivore.md) would be nice too. 🙂

sywhb commented 1 year ago

Hey @alxlg, thanks for waiting.

We have released v1.9.4 to allow users to edit the article and highlight templates, but we cannot remove the headers (## 🔖 Articles) for now due to some technical constraints.

alxlg commented 1 year ago

@sywhb

Hi, thank you very much, this is a huge improvement!

I just tried it but it renders all the properties:: on the same line and the config textbox doesn't accept Enter.

I see the default template has 6 spaces between properties but it doesn't render as multiple lines to me...

sywhb commented 1 year ago

Hey @alxlg Sorry I overlooked your message.

I have created a PR to use a textarea instead textbox for the template settings: #57 And it looks better and easier to edit.

alxlg commented 1 year ago

@sywhb don't worry, I followed the development on Discord, I just tested this and reported an issue there