This article introduces the detailed use of the document library. If you have not seen MWeb Basic use, I suggest you check it out first.
Document library structure and storage location
MWeb's document library is stored in a folder that you set up when you started using MWeb. It consists of a
docs folder, a
maillib.db file, and a
metadata folder. The
docs folder holds the relevant material for each note and note. The
mainlib.db file holds the categories and tag information as well as the categories information to which the notes belong. The
metadata folder is only available when the publishing service is used, and the information about the publishing service is saved. The figure below is a typical document library.
This structure can be well backed up and used for git, while avoiding accidental deletions, as it is impossible to delete so many documents for no reason.
Guarantee document library data security
The following figure shows the setting and backup of the document library in MWeb. The well-designed backup strategy helps ensure that the document library will never be lost. MWeb's document library is a folder. You can use the
Show in Finder button to find the location of the document library and copy it directly to another place for backup. You can also use the backup library feature for scheduled backups.
There are three about setting up a backup location. I think there may be some users who will need it, but I think there are usually no problems in two places. It is also possible to set one location in a historically recorded cloud drive like Dropbox, another location on another hard disk, or not. However, it is recommended to set a location in a cloud drive like Dropbox with a history function, or in a device like a time machine, because the document library is always synchronized with the backup location.
If you want to restore a backed up document library, please copy the backup folder to what the library location you want to, then use the
Choose a Exist Library... menu choose that location, like below:
How to use the categories tree
There are two types of MWeb categories, one is the common categories, as shown below:
One is static website categories, this categories can generate static websites, as shown below:
MWeb provides a very simple way to generate a static website from the classified documents. For example, MWeb Chinese official website is generated by MWeb's static website function.
The categories tree on the left side of the interface can be associated with the right-click and drag-and-drop to complete related management operations. The middle document list bar can drag and drop documents to the left category for document categories management. There are three cases of this drag and drop, and the following assumes that the drag is Category A:
- Drag the current document directly to Category A. In this case, if the document in the list belongs to the currently selected category, it will move to the Class A, otherwise it will be added to the Category A for the dragged document.
- Hold down the
CMDkey to drag the current document to the Category A. In this case, the added value of the dragged document is increased to Class A.
- Hold down the
Optionbutton and drag the current document to the Category A. In this case, if the dragged document belongs to the Category A, the canceled document belongs to the Class A, If it does not belong to the Class A, no action is taken.
This method of operation is more than one choice, that is, it can be managed in batches. If it is a single document, there is a better way to click on the top information bar of the editor and then check it, as shown below:
This place is also the only place where you can set the document tag. You can also use the shortcut
CMD + 8 to open this interface.
Reference between documents
It is very simple to reference other documents in MWeb. In the document list, right-click the document you want to reference and select ``.
Then paste the location of the document to be referenced
CMD + V, and MWeb will generate
[How to use Publish Script to Publish website.](how_to_use_shell_script.html). If you hold down the
CMD key and click, the referenced document will be opened.
The document library supports multiple sorting methods, and each top-level category can also set its own sorting method. There are two ways to modify the sorting method, one is as shown below:
The other is to select the top-level category to be modified or a sub-category under the top-level category, and then right-click in the document list, as shown below:
In various sorts, custom drag sorting is special and requires special instructions. Before I explain, let me explain a global option:
Group By Categories Right-click in the document list to see the menu for this function. If it is enabled, it means that the documents in the list are in the state of grouping by category, no matter what sorting settings.
This use is actually to find and organize documents. However, if this global option is not enabled, then if the sort is set to a custom drag sort, the top level will also be grouped by category. In other words, as long as it is a custom drag sort, the document list bar must be displayed in groups.
This is due to the fact that a document can belong to multiple categories and the rules are set, otherwise it will be messy.
If you try to drag and drop in a category that is not a custom sort, MWeb will prompt you to set it to a custom drag sort before you can drag and drop. Customize the documents under the drag sort category, it is recommended to ensure that only one category is classified, so drag and drop sorting will not be messy.
How to use tags
The function of the tag in MWeb is very simple. The method of setting the tag is as mentioned above. In addition, the document is viewed by Tag. The function can be tag by the
Tag button in the lower right corner of the category, as shown below:
It can be seen that MWeb will list the tags of the entire document library and the tags under the currently selected category. After selecting, you can view the documents by tag.
Document Outline View
As shown in the following figure, the document outline view will list the title and inserted images and attachments of the current document, and of course the extension items that can be used for static websites (if the current document belongs to a static website category). The figure below shows the effect of fixing the outline view.
Import and export of document libraries
As shown in the following figure, the document library supports importing Markdown documents into the document library. If you select a folder when importing, MWeb will import all the Markdown documents in the folder into the currently selected category. If there is a local image in the Markdown document of the folder, it will also be imported and modified to the image address in the document library format. This is only available in version 3.x. Version 2.x will only import Markdown text and will not import images. It should be noted that to import images, be sure to select the entire folder.
In addition, you can export the entire categories to Markdown, and the exported Markdown document will create a folder according to the structure of the categories. Creating folders by category structure is also a feature that is only available in 3.x.
The remaining two are exported to Epub and PDF. Yes, you can export the entire category to Epub or PDF!
Full keyboard navigation
At any time, you can use the shortcut
CMD + Shift + F to switch the focus to the search box (External Mode switches to the directory tree). Just remember this one, basically you can switch between the three places:
Categories Tree - List - Editor.
This is because you can switch to the editor by pressing
Tab in the search box and pressing
Down Arrow to switch to the list. When the focus is on the list, press
Left Arrow to switch to the categories tree, `
Right Arrow to switch to the editor; when the focus is on the categories tree, you can press
Right Arrow to switch to the list. In addition, you can use the
Ctrl + Tab key, the
CMD + Shift + [ or ] key to switch Tabs, and the focus will be cut to the editor when you switch Tab.
In addition, the quick search is
CMD + O. When there is no search box in the External Mode, you can use this to search.
Document Library related issues
The document library is generally work fine. The discussion here is if there is an unexpected solution.
As mentioned in the document library structure above, MWeb's document library is a folder consisting of the docs folder and the mainlib.db file in the folder. The docs folder contains all the notes, one note in one document, the file name like:
number + .md. If there is a problem with the document library, it is usually the following:
1. The document library location is incorrect.
In MWeb 3.1.4 and above, the document library location is incorrect, it will automatically open
Library & Backup and there will be a red text prompt in
Library Location, like below:
In this case, you can use the following methods to solve this problem:
- If the Library location is not you choose location, just use
Change the Library Location-
Choose a Exist Library...choose correct document library location. MWeb's Library folder contain a
docsfolder and a
- If your document library is saved on iCloud Drive, please confirm that your current iCloud account is OK.
- If you don't know, you can search the
mainlib.dbfile in the mac to find the location of the document library. Then use
Choose a Exist Library...to select that location to restore.
- If you have backed up the document library to a historically recorded cloud drive in accordance with the above guaranteed document library data security section, you can restore the document library from the history and then copy it to the MWeb document library you want to set up. Then use the
Choose a Exist Library...button to restore.
2. mainlib.db has problems or is corrupted when syncing
mainlib.db This file holds information about all categories and tags, as well as the documents that belong to the categories and tags. If you encounter a categories structure, this is the problem. Since the mainlib.db file is important, MWeb automatically backs up a mainlib.db file every day. The backup location is
~/Library/Containers/com.coderforart.MWeb3/Data/Library/Caches, you can close MWeb first, then select a backup mainlib.db file and copy it to its original location and start MWeb.
3. I want to initialize the MWeb document library
If you want to initialize MWeb's document library:
- Download https://cdn.mwebapp.cn/MWebInitLibrary.zip and unzip it, then use
Choose a Exist Library...to select that location.
- Run the command in the terminal:
defaults delete com.coderforart.MWeb3and restart MWeb. this will delete all MWeb preferences.