docs: add thésaurus table in README

This commit is contained in:
Mara 2025-02-09 18:27:49 +01:00
parent 77b02f0462
commit 55a180c79d
2 changed files with 100 additions and 28 deletions

View file

@ -6,6 +6,29 @@ Ajoute automatiquement des tags en fonction dun thésaurus au format CSV ou d
> Si vous choisissez d'utiliser un fichier Markdown, la table Markdown doit être le seul contenu du fichier.
> Cependant, vous pouvez avoir un frontmatter au début du fichier.
## 📚 Format du Thésaurus
Le thésaurus doit être un tableau avec deux colonnes : une pour les termes et une pour les synonymes. La première ligne doit contenir les en-têtes de colonnes.
> [!TIP]
> Le thésaurus peut être un fichier CSV comme ceci :
> ```csv
> Terme,Synonyme
> ordinateur,PC
> ordinateur,machine
> ordinateur,vélo
> ```
>
> Ou en format Markdown :
> ```markdown
> | Terme | Synonyme |
> |------------|---------------|
> | ordinateur | PC |
> | ordinateur | machine |
> | ordinateur | processeur |
> ```
## ⚙️ Paramètres
1. <ins>Séparateur</ins> : Le séparateur utilisé dans le fichier CSV. Les séparateurs pris en charge sont `,`, `;`, `|` et `tabulation`.

105
README.md
View file

@ -1,61 +1,110 @@
# My Thesaurus
# My Thesaurus
Automagically adds tags based on a thesaurus CSV or a Markdown table.
Automagically adds tags based on a thesaurus CSV or a Markdown table.
-> [French version](./README.fr.md)
> [!NOTE]
> If you choose to use a markdown file, the Markdown table must be the only content in the file.
> If you choose to use a markdown file, the Markdown table must be the only
> content in the file.
> But, you can have a frontmatter at the beginning of the file.
## 📚 Thesaurus Format
## ⚙️ Settings
1. <ins>Separator</ins>: The separator used in the CSV file. Supported separators are `,`, `;`, `|`, `tabulation` and `markdown`. See the note above for the markdown separator.
2. <ins>Column title</ins>: The title of the column in the CSV file that contains the tags:
- **Term**: The column contains the tags that must be set by the plugin.
- **Synonyms**: The column contains the synonyms that must be recognized by the plugin.
3. <ins>Thesaurus</ins>: Path to the file containing the thesaurus. The file must be a CSV file and must be in your vault. You can click on the `save` button to ensure the file is valid (the path is correct, the file exists, and it's well-formed).
> [!WARNING]
> If, for some reason, the file is moved, you need to update the path in the settings! It won't be updated automatically.
5. <u>Included paths</u>: Files in these folders will be included when using the command `My Thesaurus: Parse all files`. You can separate the paths with a comma, semicolon, or newline. Moreover, regex is supported.
The thesaurus must be a table with two columns: one for the terms and one for
the synonyms. The first row must contain the column headers.
> [!TIP]
> You can include all the files in your vault by using `.*` as the path!
> The thesaurus can be a CSV file like this:
> ```csv
> Tag,Synonym
> computer,PC
> computer,machine
> computer,bike
> ```
>
> Or in Markdown format:
> ```markdown
> | Tag | Synonym |
> |-----------|-----------|
> | computer | PC |
> | computer | machine |
> | computer | processor |
> ```
## 📝 Usage
The plugin has two commands:
You can have as many synonyms as you want for a term, but you need to duplicate
the term in the first column. Moreover, a synonym can be associated with
multiple terms, and the synonym can equal to the term itself.
1. <ins>My Thesaurus: Parse all files</ins>: This command will parse all the files in the included paths and add the tags based on the thesaurus. At the end, a message will be displayed with the results, including:
- **Errors**: The files that encountered an error and the specific error message.
- **Skipped files**: The files that have been skipped because no synonym was found.
- **Success**: The files that have been successfully parsed, along with the tags that have been added.
2. <ins>My Thesaurus: Parse current file</ins>: This command will parse the current file and add the tags based on the thesaurus.
## ⚙️ Settings
1. <ins>Separator</ins>: The separator used in the CSV file. Supported
separators are `,`, `;`, `|`, `tabulation` and `markdown`. See the note above
for the markdown separator.
2. <ins>Column title</ins>: The title of the column in the CSV file that
contains the tags:
- **Term**: The column contains the tags that must be set by the plugin.
- **Synonyms**: The column contains the synonyms that must be recognized by
the plugin.
3. <ins>Thesaurus</ins>: Path to the file containing the thesaurus. The file
must be a CSV file and must be in your vault. You can click on the `save`
button to ensure the file is valid (the path is correct, the file exists, and
it's well-formed).
> [!CAUTION]
> If, for some reason, the file is moved, you need to update the path in the
> settings! It won't be updated automatically.
4. <u>Included paths</u>: Files in these folders will be included when using the
command `My Thesaurus: Parse all files`. You can separate the paths with a
comma, semicolon, or newline. Moreover, regex is supported.
> [!TIP]
> You can include all the files in your vault by using `.*` as the path!
## 📝 Usage
The plugin has two commands:
1. <ins>My Thesaurus: Parse all files</ins>: This command will parse all the
files in the included paths and add the tags based on the thesaurus. At the
end, a message will be displayed with the results, including:
- **Errors**: The files that encountered an error and the specific error
message.
- **Skipped files**: The files that have been skipped because no synonym was
found.
- **Success**: The files that have been successfully parsed, along with the
tags that have been added.
2. <ins>My Thesaurus: Parse current file</ins>: This command will parse the
current file and add the tags based on the thesaurus.
## 📥 Installation
- [ ] From Obsidian's community plugins
- [x] Using BRAT with `https://github.com/Mara-Li/`
- [x] From the release page:
- [x] From the release page:
- Download the latest release
- Unzip `my-thesaurus.zip` in `.obsidian/plugins/` path
- In Obsidian settings, reload the plugin
- Enable the plugin
### 🎼 Languages
- [x] English
- [x] French
To add a translation:
1. Fork the repository
2. Add the translation in the `src/i18n/locales` folder with the name of the language (ex: `fr.json`).
- You can get your locale language from Obsidian using [obsidian translation](https://github.com/obsidianmd/obsidian-translations) or using the commands (in templater for example) : `<% tp.obsidian.moment.locale() %>`
- Copy the content of the [`en.json`](./src/i18n/locales/en.json) file in the new file
2. Add the translation in the `src/i18n/locales` folder with the name of the
language (ex: `fr.json`).
- You can get your locale language from Obsidian
using [obsidian translation](https://github.com/obsidianmd/obsidian-translations)
or using the commands (in templater for example) :
`<% tp.obsidian.moment.locale() %>`
- Copy the content of the [`en.json`](./src/i18n/locales/en.json) file in
the new file
- Translate the content
3. Edit `i18n/i18next.ts` :
- Add `import * as <lang> from "./locales/<lang>.json";`