Skip to content

Latest commit

 

History

History
376 lines (237 loc) · 18.2 KB

README_en_US.md

File metadata and controls

376 lines (237 loc) · 18.2 KB

README 中文

Daily Note Today

This plugin is mainly used for enhancement for daily note workflow in SiYuan.

The words "diary", "notes" and "daily note" may be used interchangeably in the document, so don't worry, they all mean the same thing.

See changelog in: CHANGELOG.md

  • Do I need this plugin?

  • What can this plugin to

      1. Auto-create daily note for today
      • 1.1 I have multiple notebooks, which notebook will be used to create notes by default?
      • 1.2 Blacklist
      1. Left lick the icon, quickly creating/opening today's note.
      • Update with date
      • Hotkey
      1. Right click the icon, quickly configuration.
      1. Reserve a block
      • Hotkey
      • 4.1 View scheduled appointments
      • 4.2 Currently supported date templates
      • 4.2 Notice
      1. Move blocks into today's daily note
      1. Setting pannel
  • Compatibel function | Add document attribute to past Daily Notes

  • Special Issues | Duplicate DailyNotes

  • FAQ

    • Q: I don't want to create a diary automatically.
    • Q: Is the dropdown box used for selecting the default notebook?
    • Q: How to query all reservation blocks by SQL?
    • Q: When do I need to "Update" status

Do I need this plugin?

  • This plugin** is mainly for people who use daily note workflow**, so if you're used to making notes in the document tree rather than in your daily notes, then this plugin may not be for you
  • You can use this plugin simply as a tool to automatically create a diary, just like logseq who create today's diary on start up.
  • If you use multiple notebooks and have the need to write multiple diaries in those notebooks at the same time, you can use this plugin to quickly open the diary of a specific notebook
    • Note: you can only open today's diary (after all, it's called "Daily Note Today")
    • If you need to quickly open the diary of any notebook at any time, please use the calendar plugin (not yet available, but will in future)
  • If you have the need to take notes in more than one notebook, and feel that it is troublesome to frequently open multiple diaries, you can use the Move Blocks feature provided by this plugin to quickly move the blocks in a document to the diary in the specified notebook, avoiding frequent manual switching of notebooks
  • You can also use this plugin as a simple schedule management tool. This plugin provides the function of "reservation block", hich can be used as a tool to manage today's errands

What can this plugin to

1. Auto-create daily note for today

  • When you start the plugin, it automatically creates/opens today's daily note, achieving a similar effect as in logseq
  • If you don't need it, you can turn off this feature in the settings panel
  • The custom paths and templates set in the notebook settings page are still valid

If you have enabled multi-device synchronization, duplicate daily notes may occur. For more details, please refer to section [Special Issues | Duplicate DailyNotes]

1.1 I have multiple notebooks, which notebook will be used to create notes by default?

  • By default, the plugin will automatically select the notebook that is sorted first and create today's diary in this notebook
  • If you are not satisfied with thie default setting, open the plugin in the "Settings Panel" and then manually specify the default notebook ID
    • Procedure: Right-click to open the notebook icon, click the "Settings" button, and then click "Copy ID".
    • Note: Only one notebook ID can be filled in as the default.
    • If the ID is incorrectly filled in, a warning will be given when the plugin is launched
    • For more information on how to open the settings panel, please read the later part of the document

1.2 Blacklist

If you have too many notebooks, you can choose to add some notebooks to the blacklist, so that these notebooks will not appear in the dropdown list

2. Left lick the icon, quickly creating/opening today's note.

  • The dropdown menu lists all notebooks in order.
  • Click on a notebook to open/create today's note.
  • If there is a "√" flag before a notebook option, it means that diary has already been created for that notebook.
  • Ignore "SiYuan User Guide" notebook by default.
  • The custom paths and templates set in the notebook settings page are still valid
  • Note: Don't misunderstand, this drop-down box is not for selecting the default notebook, but for opening the diary quickly! For more details, see FAQ-Q: Is the dropdown box used...

Update with date

At 0 o'clock the plug-in will automatically chime in and update the status of your diary, at which point you can click on the top bar menu to open the diary for the new day. However, it does not automatically create a diary for you.

Hotkey

  • SiYuan's built-in hotkey Alt+5 allows for quick access to the daily note document, but the notebook corresponding to the opened daily note may change with user operations.
  • The plugin provides an option in the settings that, when enabled, overrides the default hotkey behavior: after pressing Alt+5, it will only open the daily note of the default notebook set by the plugin.

3. Right click the icon, quickly configuration.

  • Click to enter the plugin settings panel
    • You can also use the official portal to enter the settings panel, but the official operation I think is too much trouble, so here provides a shortcut portal
  • Click "Update" to update the global status
    • ReadFAQ for details

4. Reserve a block

You can think of the reservation block as a simple schedule management or task reminder tool. We often encounter such requirements: we need to complete a specific task on a future date. In this case, you can use the reservation block feature:

  1. Click the block and select "Reserve this block".

  2. The plugin will automatically match the date and time in the block content, and after confirmation, the plugin will help you record the reservation.

    The matched time will be highlighted in the confirmation dialog;. As you can see below, the plug-in matches 06-24 and resolves to 2023-06-01.

  3. When the day arrives, the plugin will automatically insert the related reservations as embedded blocks into the diary entry.

  4. If you find that the embedded block for the reservation is not inserted automatically, you can update the document by clicking on the 'Update' button in the icon menu

  5. After completing the reservation block, a custom attribute custom-reservation will be automatically added to the block and memo will be filled in, making it easier for users to identify which blocks have been reserved.

  6. Click again on a block that has already been reserved and you can choose to 'Cancel Reservation'

  7. By default, all reservations will be inserted as an embedded block at the beginning of the document. If you are not satisfied with the default behavior, you can change it in the settings.

You can customize the CSS styles to display these reservation blocks. Here is an example that you can add to your code snippet:

.protyle-wysiwyg div[custom-reservation] {
    border-style: dashed;
    border-width: 1.5px;
    border-radius: 0.5rem;
    border-color: var(--b3-theme-primary);
}

With custom attributes, you can use SQL to query all reservation blocks. For more information, see FAQs.

Hotkey

Press Shift+Alt+R to trigger the reservation quickly.

4.1 View scheduled appointments

There is a panel provided in the Dock to view scheduled appointments.

Click the counter to the right side of the date, you can view all the reservations that day.

Note that only future appointments can be viewed here, and due to the limitation of data query from SiYuan, up to 32 appointments can be viewed at most. If you want to view all appointments more freely, please refer to FAQs.

4.2 Currently supported date templates

  • Standard year, month and day

    • 2020-04-01, 2020/04/01, 2020.04.01
    • 2020年5月2号, 2020年5月2日 in Chinese
    • Dates can have spaces between them: 2020-04-01 and 2020 - 04 - 01 are both ok
    • Month and date can be added with 0: 04-01, 04-1, 4-1 are possible
    • You can leave out the year, so that it will be considered the same year by default: for example, on a day in the year 23, the 09-08 will be considered as 2023-09-08.
    • Unfortunately, this plugin does not plan to provide support for users who can live beyond the year 3000, so you can only use years before 2999.

  • Relative time

    • N days later, e.g. 10 days later; Arabic numerals only
  • English date support by using chrono

    • Today, Tomorrow, Yesterday
    • 17 August 2023
    • This Friday
    • 2 weeks from now
    • Note: These english dates are currently not supported for highlighting matching text items in the confirmation window

Translated with www.DeepL.com/Translator (free version)

4.2 Notice

  1. The embeded block for reservations will be insert automatically only when the diary is created/opened automatically by the plugin
  2. You can use the 'Update' button to manually insert appointment blocks into the diary
  3. The date matching rules currently
    • It is not allowed to write in the past
    • If there are multiple dates in the compound specification, then only the first one will be matched
  4. This feature is disabled by default and should be turned on manually in the settings.

It's a pity that this version does not support English date mode very well, while it will be improved in later versions.

5. Move blocks into today's daily note

  • Select the icon leftside of a block and press "Alt + Right Click" to bring up a moving block panel. Choose a notebook to move the current block to the diary of the corresponding notebook for today.
  • Support moving single block
  • Support moving a list item
  • Move the entire header and it's children blocks
  • Disabled by default, you can enable it in the setting panel

6. Setting pannel

Compatibel function | Add document attribute to past Daily Notes

Starting from version 2.11.1, SiYuan automatically adds the custom-dailynote-yyyymmdd attribute to the document when creating a daily note, making it easier to distinguish daily note documents from regular documents.

For more details, please refer to the Github Issue #9807

Afterwards, you can query daily notes using SQL statements similar to the following example. The statement custom-dailynote-202312% will match all daily notes from December 2023:

select distinct B.* from blocks as B join attributes as A
on B.id = A.block_id
where A.name like 'custom-dailynote-202312%'
order by A.value desc;

While you need to have the corresponding document attributes set in your daily notes, which do not exist in your past daily notes. To facilitate compatibility, this plugin provides a feature to add document attributes to past daily notes.

  • Open the plugin settings - Daily Notes
  • Click the "Add document attribute to past Daily Notes" button

Then a dialog box will pop up to add document properties to past Daily Notes.

  • 🔔 About the start date issue:
    • The plugin will try to read the creation date of the earliest document created under the diary path, and then find all diaries after this date to supplement document properties for these diaries.
    • In special cases (for example, if an earlier date is manually added to the diary path later), it may happen that the plugin cannot correctly identify the earliest diary document; in this case, please manually click on 'Start Date' and set it manually (format yyyy-mm-dd).

Special Issues | Duplicate DailyNotes

Sometimes you might find the plugin suddenly pops up a dialog, telling you that the content of the DailyNote has been duplicated:

The preconditions for this issue to arise are:

  1. The plugin's auto-create DailyNote feature is enabled
  2. Multi-device synchronization is used

The reason for the issue is that within the SiYuan architecture, the plugin's initialization runs before the boot data synchronization, and both are executed asynchronously. Suppose you created a DailyNote on device A, then when you open device B, the plugin will automatically create a DailyNote for you; after that, SiYuan synchronizes the data. As a result, the DailyNote previously created on device A and the one now created on device B become duplicates.

Previously, developers attempted to add the feature "create DailyNote after synchronization", but practical tests proved it was ineffective. Currently, this setting is still retained in the plugin, but it might be removed in a future version

Currently, there is no good solution to prevent this problem. Therefore, the plugin has to find another way and has provided several automatic handling options to help users quickly deal with duplicate documents (of course, for safety, you can also handle them manually)

First, the principle for automatic processing is: the earliest created DailyNote is considered the main DailyNote, and all others are duplicates. Based on this principle, four automatic processing methods are provided:

  1. 🤲 Merge All: Merge all other duplicate documents into the main DailyNote document
  2. ❌ Delete Directly: Directly delete all other duplicate DailyNotes
  3. 🗑️ Move to Trash Bin: Under the daily note root path, a trash-bin document is created, all duplicate DailyNotes will be moved to this document and the custom-dailynote-yymmdd property will be deleted (Author Prefered)
  4. 🤔 Smart Merge: According to certain rules, documents are either deleted or merged into the main DailyNote
    • Documents that are empty, with no references or links, are directly deleted
    • Documents that are not empty, but whose update time does not exceed three seconds from the creation time (for example, DailyNotes using a template), are directly deleted
    • Other documents are merged into the main DailyNote document

Duplicate Document Prompt Dialog:

  • After the first data synchronization of the day, a check is performed for duplicate documents. If duplicate entries are found, a duplicate document prompt dialog will appear (there is no risk of document duplication in other cases).
    • You can choose the four auto-solution mentioned above in the dialog.
    • Alternatively, you can close the dialog and manually handle the duplicates as instructed.
  • The dialog will only run once when it is launched each day. After closing it, you will need to manually handle the duplicates yourself.

If you don't want to handle it manually every time, you can choose the default processing method in the settings. This way, the plugin will automatically handle repetitive entries for you.

The default setting is "Manually handle," which means a dialog box will pop up every time, allowing the user to choose a processing option.

FAQ

Q: I don't want to create a diary automatically.

Please toggle off "Open Today's Diary Automatically" in the plugin settings.

Q: Is the dropdown box used for selecting the default notebook?

  • Note: Don't misunderstand, this drop-down box is not for selecting the default notebook, but for opening the diary quickly!
  • You can totally interpret this as moving the "Create Diary" menu that comes with Siyuan to the top level and adding a diary status display.
  • To specify the default notebook, please go to Settings Panel.

For example, I currently have four notebooks. If I click the button in the drop-down box, it will open the diary for today in the corresponding notebook. Life, work, and Hobby have a "√" in front of them, which means that they have already created diaries.

At this point, if I click on "Academic Learn", then a new diary will be created under this notebook, and then you can open the drop-down box again and you will see that a √ symbol also appears in front of this notebook.

Q: How to query all reservation blocks by SQL?

If the plugin version is 1.1.1 or higher, all inserted blocks will have the custom-reservation attribute set, so you can use SQL to query them. Here is the template:

select B.*
from blocks as B
inner join attributes as A
on(
  A.block_id = B.id and 
  A.name = 'custom-reservation'
  and A.value >= strftime('%Y%m%d', datetime('now')) 
) order by A.value;

Note that the and A.value >= strftime('%Y%m%d', datetime('now')) filters out all expired reservations. If you want to view past reservations regardless, you can remove this part.

If you have installed the Query widget, you can use this SQL:

select
A.value||'000000' as __10____date__ReservationDate,
'['
||substr(B.created,1,4)
|| '-' || substr(B.created,5,2)
|| '-' || substr(B.created,7,2)
|| '](siyuan://blocks/' || B.id|| ')' as __11____pre__Created,
substr(B.content,1,30) as __22____pre__Content
from blocks as B
inner join attributes as A
on(
  A.block_id = B.id and 
  A.name = 'custom-reservation'
  and A.value >= strftime('%Y%m%d', datetime('now')) 
) order by A.value;

Q: When do I need to "Update" status

  • You want to manually update the status of notebooks
  • When "Alt + right click" can note bring up moving menu, try updating.
  • Manual update of the day's reservation block