mirror of
https://github.com/foambubble/foam.git
synced 2026-01-10 22:48:09 -05:00
Compare commits
35 Commits
feature/ls
...
v0.5.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdc2c7cf4c | ||
|
|
b0536ce9f7 | ||
|
|
a60dcaa52a | ||
|
|
799caa96a6 | ||
|
|
fb2ff3ac95 | ||
|
|
39a96a2d02 | ||
|
|
6e5c138f31 | ||
|
|
b2b1b58262 | ||
|
|
c10b73c59c | ||
|
|
74591eb192 | ||
|
|
b2ebd82f25 | ||
|
|
b2c4e9f78b | ||
|
|
b22fd50394 | ||
|
|
a34842b957 | ||
|
|
0c9bbf6747 | ||
|
|
1a85d16d10 | ||
|
|
689c11c5e8 | ||
|
|
647afa80e8 | ||
|
|
3e2cb248f2 | ||
|
|
532348633b | ||
|
|
891a182d77 | ||
|
|
ba78b9ecbe | ||
|
|
a47079168c | ||
|
|
a23e73245f | ||
|
|
4f244d6a0f | ||
|
|
4caaed4c6b | ||
|
|
74dbf485df | ||
|
|
39854277a9 | ||
|
|
5f561100e6 | ||
|
|
b1080618d3 | ||
|
|
3db28f5328 | ||
|
|
d45d715f6d | ||
|
|
d1fcba35c7 | ||
|
|
542725fe51 | ||
|
|
6364af0477 |
32
.github/ISSUE_TEMPLATE/bug.md
vendored
Normal file
32
.github/ISSUE_TEMPLATE/bug.md
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us be foamier
|
||||
labels: bug, awaiting triage
|
||||
title: [BUG]
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
<!-- A clear and concise description of what the bug is.-->
|
||||
|
||||
**Affected package**
|
||||
<!-- Its ok if you don't know! -->
|
||||
- [ ] `foam-cli`
|
||||
- [ ] `foam-core`
|
||||
- [ ] `foam-vscode`
|
||||
- [ ] `other/meta/???`
|
||||
|
||||
**To Reproduce**
|
||||
<!-- Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error -->
|
||||
|
||||
**Expected behavior**
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
**Screenshots**
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
|
||||
**Additional context**
|
||||
<!-- Add any other context about the problem here. -->
|
||||
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
blank_issues_enabled: true
|
||||
1
docs/.vscode/settings.json
vendored
1
docs/.vscode/settings.json
vendored
@@ -5,6 +5,7 @@
|
||||
"editor.overviewRulerBorder": false,
|
||||
"editor.lineHeight": 24,
|
||||
"workbench.colorTheme": "Gray Matter Light",
|
||||
"foam.edit.linkReferenceDefinitions": "withExtensions",
|
||||
"vscodeMarkdownNotes.noteCompletionConvention": "noExtension",
|
||||
"[markdown]": {
|
||||
"editor.quickSuggestions": {
|
||||
|
||||
BIN
docs/assets/images/preview-image-in-glutter.png
Normal file
BIN
docs/assets/images/preview-image-in-glutter.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
BIN
docs/assets/images/preview-image-on-hover.png
Normal file
BIN
docs/assets/images/preview-image-on-hover.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
@@ -1,11 +1,11 @@
|
||||
# Automatic Git Syncing (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -8,7 +8,7 @@ The following recipe is written with the assumption that you already have an [Az
|
||||
|
||||
## Setup a Foam workspace
|
||||
|
||||
1. Generate a Foam workspace using the [foam-template project](https://github.com/foambubble/foam-template).
|
||||
1. Generate a Foam workspace using the [foam-template project](https://github.com/foambubble/foam-template).
|
||||
2. Change the remote to a git repository in Azure DevOps (Repos -> Import a Repository -> Add Clone URL with Authentication), or copy all the files into a new Azure DevOps git repository.
|
||||
3. Define which document will be the wiki home page. To do that, create a file called `.order` in the Foam workspace root folder, with first line being the document filename without `.md` extension. For a project created from the Foam template, the file would look like this:
|
||||
```
|
||||
@@ -20,21 +20,21 @@ readme
|
||||
|
||||
|
||||
1. Navigate to your Azure DevOps project in a web browser.
|
||||
2. Choose **Overview** > **Wiki**. If you don't have wikis for your project, choose **Publish code as a wiki** on welcome page.
|
||||
2. Choose **Overview** > **Wiki**. If you don't have wikis for your project, choose **Publish code as a wiki** on welcome page.
|
||||
3. Choose repository with your Foam workspace, branch (usually `master` or `main`), folder (for workspace created from foam-template it is `/`), and wiki name, and press **Publish**.
|
||||
|
||||
A published workspace looks like this:
|
||||
|
||||

|
||||
|
||||
There is default table of contents pane to the left of the wiki content. Here, you'll find a list of all directories that are present in your Foam workspace, and all wiki pages. Page names are derived from files names, and they are listed in alphabetical order. You may reorder pages by adding filenames without `.md` extension to `.order` file.
|
||||
There is default table of contents pane to the left of the wiki content. Here, you'll find a list of all directories that are present in your Foam workspace, and all wiki pages. Page names are derived from files names, and they are listed in alphabetical order. You may reorder pages by adding filenames without `.md` extension to `.order` file.
|
||||
|
||||
_Note that first entry in `.order` file defines wiki's home page._
|
||||
|
||||
## Update wiki
|
||||
|
||||
While you are pushing changes to GitHub, you won't see the wiki updated if you don't add Azure as a remote. You can push to multiple repositories simultaneously.
|
||||
|
||||
|
||||
1. First open a terminal and check if Azure is added running: `git remote show origin`. If you don't see Azure add it in the output then follow these steps.
|
||||
2. Rename your current remote (most likely named origin) to a different name by running: `git remote rename origin main`
|
||||
3. You can then add the remote for your second remote repository, in this case, Azure. e.g `git remote add azure https://<YOUR_ID>@dev.azure.com/<YOUR_ID>/foam-notes/_git/foam-notes`. You can get it from: Repos->Files->Clone and copy the URL.
|
||||
@@ -42,9 +42,9 @@ While you are pushing changes to GitHub, you won't see the wiki updated if you d
|
||||
5. Add the `remote origin` section to the bottom of the file with the URLs from each remote repository you'd like to push to. You'll see something like that:
|
||||
```bash
|
||||
[core]
|
||||
...
|
||||
...
|
||||
(ignore this part)
|
||||
...
|
||||
...
|
||||
[branch "master"]
|
||||
remote = github
|
||||
merge = refs/heads/master
|
||||
@@ -59,5 +59,5 @@ While you are pushing changes to GitHub, you won't see the wiki updated if you d
|
||||
url = https://<YOUR_ID>@dev.azure.com/<YOUR_ID>/foam-notes/_git/foam-notes
|
||||
```
|
||||
6. You can then push to both repositories by: `git push origin master` or a single one using: `git push github master` or `git push azure master`
|
||||
|
||||
For more information, read the [Azure DevOps documentation](https://docs.microsoft.com/en-us/azure/devops/project/wiki/publish-repo-to-wiki).
|
||||
|
||||
For more information, read the [Azure DevOps documentation](https://docs.microsoft.com/en-us/azure/devops/project/wiki/publish-repo-to-wiki).
|
||||
|
||||
@@ -8,8 +8,8 @@ When using [[wiki-links]], you can find all notes that link to a specific note i
|
||||
- Finding backlinks in published Foam workspaces via [[materialized-backlinks]] is on the [[roadmap]] but not yet implemented.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[wiki-links]: wiki-links "Wiki Links"
|
||||
[make-backlinks-more-prominent]: make-backlinks-more-prominent "Make Backlinks More Prominent"
|
||||
[materialized-backlinks]: materialized-backlinks "Materialized Backlinks (stub)"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[wiki-links]: wiki-links.md "Wiki Links"
|
||||
[make-backlinks-more-prominent]: make-backlinks-more-prominent.md "Make Backlinks More Prominent"
|
||||
[materialized-backlinks]: materialized-backlinks.md "Materialized Backlinks (stub)"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[todo]: todo.md "Todo"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Block References (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
- [[2020-07-11-three-weeks-in]]
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[2020-07-11-three-weeks-in]: blog/2020-07-11-three-weeks-in "Three Weeks In"
|
||||
[2020-07-11-three-weeks-in]: blog/2020-07-11-three-weeks-in.md "Three Weeks In"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -12,5 +12,5 @@ Overall, we should strive to build big things from small things. Focused, intero
|
||||
However, there becomes a point where we may benefit from implementing a centralised solution, e.g. a syntax, an extension or perhaps a VSCode language server. As much as possible, we should allow users to operate in a decentralised manner.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[referencing-notes-by-title]: referencing-notes-by-title "Referencing notes by title"
|
||||
[referencing-notes-by-title]: referencing-notes-by-title.md "Referencing notes by title"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -70,7 +70,7 @@ const base = 'https://api.github.com';
|
||||
|
||||
|
||||
const posttime = new Date();
|
||||
const title = draft.title;
|
||||
const title = draft.title;
|
||||
const txt = draft.processTemplate("[[line|3..]]");
|
||||
const mergedTags = [...draft.tags, ...requiredTags];
|
||||
const slugbase = title.toLowerCase().replace(/\s/g, "-");
|
||||
|
||||
@@ -9,5 +9,5 @@ Create a CLI tool to allow running common Foam commands. These may include:
|
||||
More commands to be added.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[workspace-janitor]: workspace-janitor "Janitor"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[workspace-janitor]: workspace-janitor.md "Janitor"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
Head over to the [[contribution-guide]]. `CONTRIBUTING.md` file name is blocklisted on GitHub pages, and doesn't appear in the [rendered output](https://foambubble.github.io/foam).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[contribution-guide]: contribution-guide "Contribution Guide"
|
||||
[contribution-guide]: contribution-guide.md "Contribution Guide"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -42,12 +42,12 @@ For more resources related to the VS Code Extension, check out the links below:
|
||||
- [[tutorial-adding-a-new-command-to-the-vs-code-extension]]
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[good-first-task]: good-first-task "Good First Task"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[principles]: principles "Principles"
|
||||
[code-of-conduct]: code-of-conduct "Code of Conduct"
|
||||
[recipes]: recipes "Recipes"
|
||||
[recommended-extensions]: recommended-extensions "Recommended Extensions"
|
||||
[tutorial-adding-a-new-command-to-the-vs-code-extension]: tutorial-adding-a-new-command-to-the-vs-code-extension "Tutorial: Adding a New Command to the VS Code Extension"
|
||||
[todo]: todo.md "Todo"
|
||||
[good-first-task]: good-first-task.md "Good First Task"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[principles]: principles.md "Principles"
|
||||
[code-of-conduct]: code-of-conduct.md "Code of Conduct"
|
||||
[recipes]: recipes.md "Recipes"
|
||||
[recommended-extensions]: recommended-extensions.md "Recommended Extensions"
|
||||
[tutorial-adding-a-new-command-to-the-vs-code-extension]: tutorial-adding-a-new-command-to-the-vs-code-extension.md "Tutorial: Adding a New Command to the VS Code Extension"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
- You shouldn't worry too much about categorising your notes. You can always [[search-for-notes]], and explore them using the [[graph-visualisation]].
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[search-for-notes]: search-for-notes "Search for Notes"
|
||||
[graph-visualisation]: graph-visualisation "Graph visualisation"
|
||||
[search-for-notes]: search-for-notes.md "Search for Notes"
|
||||
[graph-visualisation]: graph-visualisation.md "Graph visualisation"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -5,6 +5,6 @@ You can edit `assets/css/style.scss` to change how published pages look.
|
||||
[[todo]] [[good-first-task]]
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[good-first-task]: good-first-task "Good First Task"
|
||||
[todo]: todo.md "Todo"
|
||||
[good-first-task]: good-first-task.md "Good First Task"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -50,5 +50,5 @@ If you want this behavior now, you can use the excellent [Auto Run Command](http
|
||||
Please see [[note-macros]]
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[note-macros]: note-macros "Custom Note Macros"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[note-macros]: note-macros.md "Custom Note Macros"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
We have two alternative recipes for displaying diagrams in markdown:
|
||||
|
||||
- [Mermaid](#mermaid)
|
||||
- [Draw.io](#drawio)
|
||||
- [Diagrams in Markdown](#diagrams-in-markdown)
|
||||
- [Mermaid](#mermaid)
|
||||
- [Draw.io](#drawio)
|
||||
- [Using Draw.io](#using-drawio)
|
||||
|
||||
|
||||
## Mermaid
|
||||
@@ -27,5 +29,5 @@ You can use [Mermaid](https://marketplace.visualstudio.com/items?itemName=bierne
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[github-pages]: github-pages "Github Pages"
|
||||
[github-pages]: github-pages.md "Github Pages"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Eleventy and Netlify
|
||||
|
||||
You can use [foam-eleventy-template](https://github.com/juanfrank77/foam-eleventy-template) to generate a static site with [Eleventy](https://www.11ty.dev/), and host it online on [Netlify](https://www.netlify.com/).
|
||||
You can use [foam-eleventy-template](https://github.com/juanfrank77/foam-eleventy-template) to generate a static site with [Eleventy](https://www.11ty.dev/), and host it online on [Netlify](https://www.netlify.com/).
|
||||
|
||||
With this template you can
|
||||
- Have control over what to publish and what to keep private
|
||||
- Have control over what to publish and what to keep private
|
||||
- Customize the styling of the site to your own liking
|
||||
|
||||
## Publishing your foam
|
||||
|
||||
@@ -96,13 +96,13 @@ Useful for knowing what needs to be supported. See [[feature-comparison]].
|
||||
- [[foam-core-2020-07-11]]
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[workspace-janitor]: workspace-janitor "Janitor"
|
||||
[cli]: cli "Command Line Interface"
|
||||
[build-vs-assemble]: build-vs-assemble "Build vs Assemble"
|
||||
[wiki-links]: wiki-links "Wiki Links"
|
||||
[link-reference-definitions]: link-reference-definitions "Link Reference Definitions"
|
||||
[materialized-backlinks]: materialized-backlinks "Materialized Backlinks (stub)"
|
||||
[todo]: todo "Todo"
|
||||
[feature-comparison]: feature-comparison "Feature comparison"
|
||||
[foam-core-2020-07-11]: meeting-notes/foam-core-2020-07-11 "Foam Core 2020-07-11"
|
||||
[workspace-janitor]: workspace-janitor.md "Janitor"
|
||||
[cli]: cli.md "Command Line Interface"
|
||||
[build-vs-assemble]: build-vs-assemble.md "Build vs Assemble"
|
||||
[wiki-links]: wiki-links.md "Wiki Links"
|
||||
[link-reference-definitions]: link-reference-definitions.md "Link Reference Definitions"
|
||||
[materialized-backlinks]: materialized-backlinks.md "Materialized Backlinks (stub)"
|
||||
[todo]: todo.md "Todo"
|
||||
[feature-comparison]: feature-comparison.md "Feature comparison"
|
||||
[foam-core-2020-07-11]: meeting-notes/foam-core-2020-07-11.md "Foam Core 2020-07-11"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -17,6 +17,6 @@ Here are a few specific constraints, mainly because our tooling is a bit fragmen
|
||||
- **In addition to normal Markdown Links syntax you can use `[[media-wiki]]` links.** See [[wiki-links]] for more details.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[decision-needed]: decision-needed "Decision Needed"
|
||||
[wiki-links]: wiki-links "Wiki Links"
|
||||
[decision-needed]: decision-needed.md "Decision Needed"
|
||||
[wiki-links]: wiki-links.md "Wiki Links"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
25
docs/foam-gatsby-template.md
Normal file
25
docs/foam-gatsby-template.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Foam Gatsby Template
|
||||
|
||||
You can use [foam-gatsby-template](https://github.com/mathieudutour/foam-gatsby-template) to generate a static site to host it online on Github or [Vercel](https://vercel.com).
|
||||
|
||||
## Publishing your foam to Github pages
|
||||
It comes configured with Github actions to auto deploy to Github pages when changes are pushed to your main branch.
|
||||
|
||||
## Publishing your foam to Vercel
|
||||
|
||||
When you're ready to publish, run a local build.
|
||||
```bash
|
||||
cd _layouts
|
||||
npm run build
|
||||
```
|
||||
|
||||
Remove `public` from your .gitignore file then commit and push your public folder in `_layouts` to Github.
|
||||
|
||||
Log into your Vercel account. (Create one if you don't have it already.)
|
||||
|
||||
Import your project. Select `_layouts/public` as your root directory and click **Continue**. Then name your project and click **Deploy**.
|
||||
|
||||
That's it!
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Foam Linter (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
58
docs/foam-local-plugins.md
Normal file
58
docs/foam-local-plugins.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# Foam Local Plugins
|
||||
|
||||
Foam can use workspace plugins to provide customization for users.
|
||||
|
||||
## ATTENTION
|
||||
|
||||
This feature is experimental and its API subject to change.
|
||||
**Local plugins can execute arbitrary code on your machine** - ensure you trust the content of the repo.
|
||||
|
||||
## Goal
|
||||
|
||||
Here are some of the things that we could enable with local plugins in Foam:
|
||||
- extend the document syntax to support roam style attributes (e.g. `stage:: seedling`)
|
||||
- automatically add tags to my notes based on the location in the repo (e.g. notes in `/areas/finance` will automatically get the `#finance` tag)
|
||||
- add a new CLI command to support some internal use case or automate import/export
|
||||
- extend the VSCode experience to support one's own workflow, e.g. weekly note, templates, extra panels, foam model derived TOC, ... all without having to write/deploy a VSCode extension
|
||||
|
||||
## How to enable local plugins
|
||||
|
||||
Plugins can execute arbitrary code on the client's machine.
|
||||
For this reason this feature is disabled by default, and needs to be explicitly enabled.
|
||||
|
||||
To enable the feature:
|
||||
- create a `~/.foam/config.json` file
|
||||
- add the following content to the file
|
||||
```
|
||||
{
|
||||
"experimental": {
|
||||
"localPlugins": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For security reasons this setting can only be defined in the user settings file.
|
||||
(otherwise a malicious repo could set it via its `./foam/config.json`)
|
||||
|
||||
- [[todo]] an additional security mechanism would involve having an explicit list of whitelisted repo paths where plugins are allowed. This would provide finer grain control over when to enable or disable the feature.
|
||||
|
||||
|
||||
## Technical approach
|
||||
|
||||
When Foam is loaded it will check whether the experimental local plugin feature is enabled, and in such case it will:
|
||||
- check `.foam/plugins` directory.
|
||||
- each directory in there is considered a plugin
|
||||
- the layout of each directory is
|
||||
- `index.js` contains the main info about the plugin, specifically it exports:
|
||||
- `name: string` the name of the plugin
|
||||
- `description?: string` the description of the plugin
|
||||
- `graphMiddleware?: Middleware` an object that can intercept calls to the Foam graph
|
||||
- `parser?: ParserPlugin` an object that interacts with the markdown parsing phase
|
||||
|
||||
Currently for simplicity we keep everything in one file. We might in the future split the plugin by domain (e.g. vscode, cli, core, ...)
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo.md "Todo"
|
||||
[//end]: # "Autogenerated link references"
|
||||
@@ -12,8 +12,8 @@
|
||||
- Check the formatting rules for links on [[foam-file-format]], [[wiki-links]] and [[link-formatting-and-autocompletion]]
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[recommended-extensions]: recommended-extensions "Recommended Extensions"
|
||||
[foam-file-format]: foam-file-format "Foam File Format"
|
||||
[wiki-links]: wiki-links "Wiki Links"
|
||||
[link-formatting-and-autocompletion]: link-formatting-and-autocompletion "Link Formatting and Autocompletion"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[recommended-extensions]: recommended-extensions.md "Recommended Extensions"
|
||||
[foam-file-format]: foam-file-format.md "Foam File Format"
|
||||
[wiki-links]: wiki-links.md "Wiki Links"
|
||||
[link-formatting-and-autocompletion]: link-formatting-and-autocompletion.md "Link Formatting and Autocompletion"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -46,6 +46,6 @@ You can view a page's backlinks using either of the following techniques:
|
||||
|
||||
## Daily Pages
|
||||
|
||||
In addition to create arbitrary pages, you can also use GistPad for journaling or capturing [daily notes](https://github.com/vsls-contrib/gistpad#daily-pages). Simply click the calendar icon in the `Repositories` tree, which will open up the page that represents today. If the page doesn't already exist, then it will be created in the workspace before being opened.
|
||||
In addition to creating arbitrary pages, you can use GistPad for journaling or capturing [daily notes](https://github.com/vsls-contrib/gistpad#daily-pages). Simply click the calendar icon in the `Repositories` tree, which will open up the page that represents today. If the page doesn't already exist, then it will be created in the workspace before being opened.
|
||||
|
||||
<img width="700px" src="https://user-images.githubusercontent.com/116461/87234721-b356cc00-c388-11ea-946a-e7f9c92258a6.png" />
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Git Flows for Teams (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -13,6 +13,6 @@ The quick and easy way is to use the Git: Commit All command after editing files
|
||||
This could be improved. [[todo]] [[good-first-task]]
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[good-first-task]: good-first-task "Good First Task"
|
||||
[todo]: todo.md "Todo"
|
||||
[good-first-task]: good-first-task.md "Good First Task"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -4,9 +4,22 @@
|
||||
- The default GitHub Pages template is called [Primer](https://github.com/pages-themes/primer). See Primer docs for how to customise html layouts and templates.
|
||||
- GitHub Pages is built on [Jekyll](https://jekyllrb.com/), so it supports things like permalinks, front matter metadata etc.
|
||||
|
||||
## Other templates
|
||||
There are many other templates which also support publish your foam workspace to github pages
|
||||
|
||||
* gatsby-digital-garden
|
||||
* [repo](https://github.com/mathieudutour/gatsby-digital-garden)
|
||||
* [demo-website](https://mathieudutour.github.io/gatsby-digital-garden/)
|
||||
* foam-mkdocs-template
|
||||
* [repo](https://github.com/Jackiexiao/foam-mkdocs-template)
|
||||
* [demo-website](https://jackiexiao.github.io/foam/)
|
||||
* foam-jekyll-template
|
||||
* [repo](https://github.com/hikerpig/foam-jekyll-template)
|
||||
* [demo-website](https://blog.hikerpig.cn/wiki/)
|
||||
|
||||
[[todo]] [[good-first-task]] Improve this documentation
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[good-first-task]: good-first-task "Good First Task"
|
||||
[todo]: todo.md "Todo"
|
||||
[good-first-task]: good-first-task.md "Good First Task"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -11,13 +11,23 @@ Generate a solution using the [Foam template].
|
||||
Change the remote to GitLab, or copy all the files into a new GitLab repo.
|
||||
|
||||
### Add a _config.yaml
|
||||
Add another file to the root directory (the one with `readme.md` in it) called `_config.yaml` (no extension)
|
||||
Add another file to the root directory (the one with `readme.md` in it) called `_config.yaml` (no extension)
|
||||
|
||||
```yaml
|
||||
title: My Awesome Foam Project
|
||||
baseurl: "" # the subpath of your site, e.g. /blog
|
||||
url: "/" # the base hostname & protocol for your site
|
||||
theme: jekyll-theme-minimal
|
||||
plugins:
|
||||
- jekyll-optional-front-matter
|
||||
optional_front_matter:
|
||||
remove_originals: true
|
||||
defaults:
|
||||
-
|
||||
scope:
|
||||
path: "" # we need to add this to properly render layouts
|
||||
values:
|
||||
layout: "default"
|
||||
```
|
||||
|
||||
You can choose a theme if you want from places like [Jekyll Themes](https://jekyllthemes.io/)
|
||||
@@ -32,7 +42,7 @@ source "https://rubygems.org"
|
||||
gem "jekyll"
|
||||
gem "jekyll-theme-minimal"
|
||||
gem "jekyll-optional-front-matter"
|
||||
```
|
||||
```
|
||||
|
||||
Commit the file and push it to gitlab.
|
||||
|
||||
|
||||
@@ -5,5 +5,5 @@ See the backlinks of this page for good first contribution opportunities.
|
||||
[[materialized-backlinks]] would help here.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[materialized-backlinks]: materialized-backlinks "Materialized Backlinks (stub)"
|
||||
[materialized-backlinks]: materialized-backlinks.md "Materialized Backlinks (stub)"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Graph in Published Workspace (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -15,7 +15,7 @@ Recipes are intended to document:
|
||||
|
||||
The first section should be a bulleted list of extensions required to use this recipe. At a minimum, this section should list all additional, non-standard extensions.
|
||||
|
||||
Ideally, you should also note which Foam [[recommended-extensions]] are responsible for providing this feature, so any issue reports can be directed to the correct repositories.
|
||||
Ideally, you should also note which Foam [[recommended-extensions]] are responsible for providing this feature, so any issue reports can be directed to the correct repositories.
|
||||
|
||||
When creating new recipes, if you don't know which extension does what, you can leave it out.
|
||||
|
||||
@@ -33,10 +33,10 @@ That's pretty much it!
|
||||
|
||||
You can add [[recipes]] by creating a pull request to [foambubble/foam](https://github.com/foambubble/foam) on GitHub.
|
||||
|
||||
Read more in our [[contribution-guide]].
|
||||
Read more in our [[contribution-guide]].
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[recommended-extensions]: recommended-extensions "Recommended Extensions"
|
||||
[recipes]: recipes "Recipes"
|
||||
[contribution-guide]: contribution-guide "Contribution Guide"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[recommended-extensions]: recommended-extensions.md "Recommended Extensions"
|
||||
[recipes]: recipes.md "Recipes"
|
||||
[contribution-guide]: contribution-guide.md "Contribution Guide"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Improve Default Workspace Settings (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Improved Backlinking (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Improved Static Site Generation (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
@@ -10,6 +10,6 @@ If you're interested in working on it, please start a conversation in [GitHub is
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -16,7 +16,7 @@ Uncategorised thoughts, to be added
|
||||
- Every Foam could have a different theme even in the editor, so you'll see it like they see it
|
||||
- UI and layout design of your workspace can become a thing
|
||||
- Developer documentation
|
||||
- GistPad has a good vs code contrib primer: https://github.com/jevakallio/gistpad/blob/master/CONTRIBUTING.md
|
||||
- GistPad has a good vs code contrib primer: https://github.com/jevakallio/gistpad/blob/master/CONTRIBUTING.md
|
||||
- VS Code Notebooks API
|
||||
- https://code.visualstudio.com/api/extension-guides/notebook
|
||||
- Snippets in template
|
||||
|
||||
@@ -11,7 +11,7 @@ You can use **Foam** for organising your research, keeping re-discoverable notes
|
||||
</p>
|
||||
|
||||
<div class="website-only">
|
||||
<a class="github-button" href="https://github.com/foambubble/foam" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star foambubble/foam on GitHub">Star</a>
|
||||
<a class="github-button" href="https://github.com/foambubble/foam" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star foambubble/foam on GitHub">Star</a>
|
||||
<a class="github-button" href="https://github.com/foambubble/foam-template" data-icon="octicon-repo-template" data-size="large" aria-label="Use this template foambubble/foam-template on GitHub">Use this template</a>
|
||||
</div>
|
||||
|
||||
@@ -181,13 +181,13 @@ If that sounds like something you're interested in, I'd love to have you along o
|
||||
Foam is licensed under the [MIT license](license).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[graph-visualisation]: graph-visualisation "Graph visualisation"
|
||||
[backlinking]: backlinking "Backlinking"
|
||||
[recommended-extensions]: recommended-extensions "Recommended Extensions"
|
||||
[recipes]: recipes "Recipes"
|
||||
[frequently-asked-questions]: frequently-asked-questions "Frequently Asked Questions"
|
||||
[known-issues]: known-issues "Known Issues"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[principles]: principles "Principles"
|
||||
[contribution-guide]: contribution-guide "Contribution Guide"
|
||||
[graph-visualisation]: graph-visualisation.md "Graph visualisation"
|
||||
[backlinking]: backlinking.md "Backlinking"
|
||||
[recommended-extensions]: recommended-extensions.md "Recommended Extensions"
|
||||
[recipes]: recipes.md "Recipes"
|
||||
[frequently-asked-questions]: frequently-asked-questions.md "Frequently Asked Questions"
|
||||
[known-issues]: known-issues.md "Known Issues"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[principles]: principles.md "Principles"
|
||||
[contribution-guide]: contribution-guide.md "Contribution Guide"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -53,6 +53,6 @@ You may have noticed that we only made modifications to the template `_layouts/p
|
||||
Finally, if all goes well, then our site hosted on Vercel will support rendering math equations with KaTeX after commiting these changes to GitHub. Here's a demo of the default template with KaTeX support: [Foam Template with KaTeX support](https://foam-template.vercel.app/).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[math-support]: math-support "Math Support"
|
||||
[vercel]: vercel "Vercel"
|
||||
[math-support]: math-support.md "Math Support"
|
||||
[vercel]: vercel.md "Vercel"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
- [ ]
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[todo]: todo.md "Todo"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
- [x] ~~This is because the link styling hack in `assets/css/style.scss`~~
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[graph-visualisation]: graph-visualisation "Graph visualisation"
|
||||
[graph-visualisation]: graph-visualisation.md "Graph visualisation"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -6,14 +6,14 @@ Foam relies heavily on our [[recommended-extensions]], and each extension has sl
|
||||
|
||||
## Short version
|
||||
|
||||
- Name your files in `lower-dash-case.md`.
|
||||
- Name your files in `lower-dash-case.md`.
|
||||
- Read on: [How to name your files](#how-to-name-your-files)
|
||||
- Use [[wiki-links]] that match the file name exactly, without file extension: `[[lower-dash-case]]`
|
||||
- Read on: [How to format your links](#how-to-format-your-links)
|
||||
- Read on: [How to autocomplete your links correctly](#how-to-autocomplete-your-links-correctly)
|
||||
- Ensure every file has a `# Heading` element
|
||||
- This will be used as your document title.
|
||||
|
||||
|
||||
## How to name your files
|
||||
|
||||
As described in [[foam-file-format]], **Foam file names should not contain spaces.** Because of the [Markdown Notes](https://marketplace.visualstudio.com/items?itemName=kortina.vscode-markdown-notes) extension's default behaviour, we recommend naming your files in lower-dash-case: `foam-file-format.md`.
|
||||
@@ -68,8 +68,8 @@ Now your autocomplete will look like the below screenshot:
|
||||
If you created your Foam from the official [foam-template](https://github.com/foambubble/foam-template) project after 27th July 2020, this setting should be already correctly set.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[wiki-links]: wiki-links "Wiki Links"
|
||||
[recommended-extensions]: recommended-extensions "Recommended Extensions"
|
||||
[foam-file-format]: foam-file-format "Foam File Format"
|
||||
[principles]: principles "Principles"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[wiki-links]: wiki-links.md "Wiki Links"
|
||||
[recommended-extensions]: recommended-extensions.md "Recommended Extensions"
|
||||
[foam-file-format]: foam-file-format.md "Foam File Format"
|
||||
[principles]: principles.md "Principles"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -53,7 +53,7 @@ Problem space in essence:
|
||||
|
||||
- During edit-time (when modifying the markdown files in an editor)
|
||||
- link reference definitions are needed if user uses editor extensions that don't understand wikilinks
|
||||
- link reference definitions may be annoying since they
|
||||
- link reference definitions may be annoying since they
|
||||
- add content to files that the user hasn't typed in by themselves
|
||||
- get out of date if user uses a tool that doesn't autogenerate them
|
||||
- may clutter the search results
|
||||
@@ -68,7 +68,7 @@ The potential solution:
|
||||
- Make format of the link reference definition configurable (whether to include '.md' or not)
|
||||
- Out of recommended extensions, currently only "markdown links" doesn't support them (?). However even its [code](https://github.com/tchayen/markdown-links/blob/master/src/parsing.ts#L25) seems to include wikilink parser, so it might just be a bug?
|
||||
- For build-time
|
||||
- To satisfy mutually incompatible constraints between GitHub UI, VSCode UI, and GitHub Pages, we should add a pre-processing/build step for pushing to GitHub Pages.
|
||||
- To satisfy mutually incompatible constraints between GitHub UI, VSCode UI, and GitHub Pages, we should add a pre-processing/build step for pushing to GitHub Pages.
|
||||
- This would be a GitHub action (or a local script, ran via foam-cli) that outputs publish-friendly markdown format for static site generators and other publishing tools
|
||||
- This build step should be pluggable, so that other transformations could be ran during it
|
||||
- Have publish targets defined in settings, that support both turning the link reference definitions on/off and defining their format (.md or not). Example draft (including also edit-time aspect):
|
||||
@@ -111,7 +111,7 @@ The potential solution:
|
||||
WikiLinksToMarkdown, // links using wiki-format [[link]] are converted to normal md links: [link](./some/file.md)
|
||||
// if this is set, not link reference definitions are generated (not needed)
|
||||
}
|
||||
|
||||
|
||||
// Defines if and how link reference definition section is generated
|
||||
enum LinkReferenceDefinitions {
|
||||
Off, // link reference definitions are not generated
|
||||
@@ -135,7 +135,7 @@ UI-wise, the publish targets could be picked in some similar fashion as the run/
|
||||
- [tracking issue on GitHub](https://github.com/foambubble/foam/issues/16)
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[wiki-links]: wiki-links "Wiki Links"
|
||||
[link-reference-definitions]: link-reference-definitions "Link Reference Definitions"
|
||||
[backlinking]: backlinking "Backlinking"
|
||||
[wiki-links]: wiki-links.md "Wiki Links"
|
||||
[link-reference-definitions]: link-reference-definitions.md "Link Reference Definitions"
|
||||
[backlinking]: backlinking.md "Backlinking"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -16,7 +16,7 @@ The following example:
|
||||
[wiki-links]: wiki-links "Wiki Links"
|
||||
[github-pages]: github-pages "Github Pages"
|
||||
```
|
||||
You can open the [raw markdown](https://raw.githubusercontent.com/foambubble/foam/master/foam-file-format.md) to see them at the bottom of this file
|
||||
You can open the [raw markdown](https://foambubble.github.io/foam/foam-file-format.md) to see them at the bottom of this file
|
||||
|
||||
## Specification
|
||||
|
||||
@@ -34,7 +34,7 @@ You can choose to generate link reference definitions with or without file exten
|
||||
- Links with file extensions work better with standard markdown-based tools, such as GitHub web UI.
|
||||
- Links without file extensions work better with certain web publishing tools that treat links as literal urls and don't transform them automatically, such as the standard GitHub pages installation.
|
||||
|
||||
By default, Foam generates links without file extensions for legacy reasons, but this may change in future versions.
|
||||
By default, Foam generates links without file extensions for legacy reasons, but this may change in future versions.
|
||||
|
||||
You can override this setting in your Foam workspace's `settings.json`:
|
||||
|
||||
@@ -43,7 +43,7 @@ You can override this setting in your Foam workspace's `settings.json`:
|
||||
|
||||
### Ignoring files
|
||||
|
||||
Sometimes, you may want to ignore certain files or folders, so that Foam doesn't generate link reference definitions to them.
|
||||
Sometimes, you may want to ignore certain files or folders, so that Foam doesn't generate link reference definitions to them.
|
||||
|
||||
For instance, if you're using a local instance of [Jekyll](https://jekyllrb.com/), you may find that it writes copies of each `.md` file into a `_site` directory, which may lead to Foam generating references to them instead of the original source notes.
|
||||
|
||||
@@ -58,7 +58,7 @@ You can ignore the `_site` directory by adding the following to your `.vscode/se
|
||||
},
|
||||
```
|
||||
|
||||
After changing the setting in your workspace, you can run the [[workspace-janitor]] command to convert all existing definitions.
|
||||
After changing the setting in your workspace, you can run the [[workspace-janitor]] command to convert all existing definitions.
|
||||
|
||||
[[Todo]] _Implement a `foam.eclude
|
||||
|
||||
@@ -68,6 +68,7 @@ See [[link-reference-definition-improvements]] for further discussion on current
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[workspace-janitor]: workspace-janitor "Janitor"
|
||||
[link-reference-definition-improvements]: link-reference-definition-improvements "Link Reference Definition Improvements"
|
||||
[workspace-janitor]: workspace-janitor.md "Janitor"
|
||||
[Todo]: todo.md "Todo"
|
||||
[link-reference-definition-improvements]: link-reference-definition-improvements.md "Link Reference Definition Improvements"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Linking between Published Workspaces (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -20,5 +20,5 @@ In the future we'll want to improve this feature by
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[materialized-backlinks]: materialized-backlinks "Materialized Backlinks (stub)"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[materialized-backlinks]: materialized-backlinks.md "Materialized Backlinks (stub)"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Materialized Backlinks (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
@@ -12,6 +12,6 @@ The idea would be to automatically generate lists of backlinks (and optionally,
|
||||
- Make Foam notes more portable to different apps and long-term storage
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -18,9 +18,9 @@ Published Foam pages don't support math formulas by default. To enable this feat
|
||||
</script>
|
||||
```
|
||||
|
||||
This approach uses the [MathJax](https://www.mathjax.org/) library to render anything delimited by ```$``` (customizable in the snippet above) pairs to inline math and ```$$``` to blocks of math (like a html div tag) using with the AMS-LaTeX dialect embedded within MathJax.
|
||||
This approach uses the [MathJax](https://www.mathjax.org/) library to render anything delimited by ```$``` (customizable in the snippet above) pairs to inline math and ```$$``` to blocks of math (like a html div tag) using with the AMS-LaTeX dialect embedded within MathJax.
|
||||
|
||||
Example of inline math using `$...$`:
|
||||
Example of inline math using `$...$`:
|
||||
|
||||
`$e^{i \pi}+1=0$`, becomes $e^{i \pi}+1=0$
|
||||
|
||||
@@ -30,7 +30,7 @@ Example of a math block using `$$...$$`:
|
||||
|
||||
Becomes:
|
||||
|
||||
$$ f_{\mathbf{X}}\left(x_{1}, \ldots, x_{k}\right)=\frac{\exp \left(-\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^{\mathrm{T}} \mathbf{\Sigma}^{-1}(\mathbf{x}-\boldsymbol{\mu})\right)}{\sqrt{(2 \pi)^{k}|\mathbf{\Sigma}|}} $$
|
||||
$$ f_{\mathbf{X}}\left(x_{1}, \ldots, x_{k}\right)=\frac{\exp \left(-\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^{\mathrm{T}} \mathbf{\Sigma}^{-1}(\mathbf{x}-\boldsymbol{\mu})\right)}{\sqrt{(2 \pi)^{k}|\mathbf{\Sigma}|}} $$
|
||||
|
||||
## Alternative approaches
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# MDX by Default(stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -122,6 +122,6 @@ How others solve this:
|
||||
- Unique ids -- could support optionally as part of file name or front matter metadata. Should not be required.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: ../todo "Todo"
|
||||
[Index]: ../index "Foam"
|
||||
[todo]: ../todo.md "Todo"
|
||||
[Index]: ../index.md "Foam"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Migrating from Obsidian (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Migrating from Roam (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Mobile Apps
|
||||
|
||||
We must always ask ourselves, [[build-vs-assemble]].
|
||||
We must always ask ourselves, [[build-vs-assemble]].
|
||||
|
||||
This Roadmap item discusses existing assembled solutions, and some thoughts on future Foam mobile experience.
|
||||
|
||||
@@ -10,7 +10,7 @@ This Roadmap item discusses existing assembled solutions, and some thoughts on f
|
||||
|
||||
#### Pros
|
||||
- Open source
|
||||
- Already a usable solution.
|
||||
- Already a usable solution.
|
||||
- Provides functionality to edit, create, and browser markdown files.
|
||||
- Support journal mode, todo lists, and free writing
|
||||
- Syncs to GitHub repo
|
||||
@@ -43,7 +43,6 @@ Given the effort vs reward ratio, it's a low priority for core team, but if some
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[build-vs-assemble]: build-vs-assemble "Build vs Assemble"
|
||||
[wiki-links]: wiki-links "Wiki Links"
|
||||
[workspace-janitor]: workspace-janitor "Janitor"
|
||||
[build-vs-assemble]: build-vs-assemble.md "Build vs Assemble"
|
||||
[workspace-janitor]: workspace-janitor.md "Janitor"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -58,6 +58,6 @@ If you have any issues or questions please look at the [README.md](https://githu
|
||||
If you run into any issues that are not fixed by referring to the README or feature requests please open an [issue](https://github.com/kneely/note-macros/issues).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[daily-notes]: daily-notes "Daily notes"
|
||||
[daily-notes]: daily-notes.md "Daily notes"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Officially Support Alternative Templates (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
@@ -8,6 +8,6 @@ If you're interested in working on it, please start a conversation in [GitHub is
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Packaged Desktop App (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -48,12 +48,6 @@ We could provide snippets that expand out into the associated markdown syntax, l
|
||||
|
||||
The JSON for these snippets can be found [here](https://github.com/foambubble/foam/pull/192#issuecomment-666736270).
|
||||
|
||||
[//begin]: # 'Autogenerated link references for markdown compatibility'
|
||||
[custom-snippets]: custom-snippets 'Adding Custom Snippets'
|
||||
[//end]: # 'Autogenerated link references'
|
||||
[//begin]: # 'Autogenerated link references for markdown compatibility'
|
||||
[custom-snippets]: custom-snippets 'Adding Custom Snippets'
|
||||
[//end]: # 'Autogenerated link references'
|
||||
[//begin]: # 'Autogenerated link references for markdown compatibility'
|
||||
[custom-snippets]: custom-snippets 'Adding Custom Snippets'
|
||||
[//end]: # 'Autogenerated link references'
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[custom-snippets]: custom-snippets.md "Adding Custom Snippets"
|
||||
[//end]: # "Autogenerated link references"
|
||||
@@ -49,9 +49,9 @@ While Foam uses tools popular among computer programmers, Foam should be inclusi
|
||||
- **Foam is for everyone** As a foam user, you support everyone's quest for knowledge and self-improvement, not only your own, or folks' who look like you. All participants in Foam repositories, discussion forums, physical and virtual meeting spaces etc are expected to respect each other as described in our [[code-of-conduct]]. **Foam is not for toxic tech bros.**
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[recipes]: recipes "Recipes"
|
||||
[recommended-extensions]: recommended-extensions "Recommended Extensions"
|
||||
[contribution-guide]: contribution-guide "Contribution Guide"
|
||||
[code-of-conduct]: code-of-conduct "Code of Conduct"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[recipes]: recipes.md "Recipes"
|
||||
[recommended-extensions]: recommended-extensions.md "Recommended Extensions"
|
||||
[contribution-guide]: contribution-guide.md "Contribution Guide"
|
||||
[code-of-conduct]: code-of-conduct.md "Code of Conduct"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -23,5 +23,5 @@ Would be cool if Foam pages could be published. Some ideas here.
|
||||
- [ ] More granular access control? Email someone a link with a hash? [Testing](testing.md)
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[build-vs-assemble]: build-vs-assemble "Build vs Assemble"
|
||||
[build-vs-assemble]: build-vs-assemble.md "Build vs Assemble"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Publishing Permissions(stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
@@ -10,6 +10,6 @@ If you're interested in working on it, please start a conversation in [GitHub is
|
||||
- Share specific page (with private hash)
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1 +1 @@
|
||||
# Random thoughts
|
||||
# Random thoughts
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[Todo]: todo "Todo"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[Todo]: todo.md "Todo"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -23,6 +23,7 @@ Guides, tips and strategies for getting the most out of your Foam workspace!
|
||||
## Take smart notes
|
||||
|
||||
- Introduction to Zettelkasten [[todo]]
|
||||
- Clip webpages with [[web-clipper]]
|
||||
|
||||
## Discover
|
||||
- Explore your notes using [[graph-visualisation]]
|
||||
@@ -41,6 +42,7 @@ Guides, tips and strategies for getting the most out of your Foam workspace!
|
||||
- Prettify your links, [[automatically-expand-urls-to-well-titled-links]]
|
||||
- Style your environment with [[custom-markdown-preview-styles]]
|
||||
- Paste and link [[images-from-your-clipboard]]
|
||||
- [[shows-image-preview-on-hover]]
|
||||
- [Markdown All-in-One](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one) features [[todo]] [[good-first-task]]
|
||||
- Manage checklists
|
||||
- Automatic Table of Contents
|
||||
@@ -57,11 +59,15 @@ Guides, tips and strategies for getting the most out of your Foam workspace!
|
||||
|
||||
## Publish
|
||||
|
||||
- Publish to [[github-pages]]
|
||||
- Publish to [[gitlab-pages]]
|
||||
- Publish your site with [[eleventy-and-netlify]]
|
||||
- Publish to [[azure-devops-wiki]]
|
||||
- Publish to [[vercel]]
|
||||
- Publish using official Foam template
|
||||
- Publish to [[github-pages]]
|
||||
- Publish to [[gitlab-pages]]
|
||||
- Publish to [[azure-devops-wiki]]
|
||||
- Publish to [[vercel]]
|
||||
- Publish using community templates
|
||||
- [[eleventy-and-netlify]] by [@juanfrank77](https://github.com/juanfrank77)
|
||||
- [[foam-gatsby-template]] by [@mathieudutour](https://github.com/mathieudutour)
|
||||
- [foamy-nextjs](https://github.com/yenly/foamy-nextjs) by [@yenly](https://github.com/yenly)
|
||||
- Make the site your own by [[customising-styles]].
|
||||
- Render math symbols, by either
|
||||
- adding client-side [[math-support]] to the default [[github-pages]] site
|
||||
@@ -92,32 +98,35 @@ Thought of a recipe but don't see a category for them? Add them here and we'll o
|
||||
_See [[contribution-guide]] and [[how-to-write-recipes]]._
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[contribution-guide]: contribution-guide "Contribution Guide"
|
||||
[how-to-write-recipes]: how-to-write-recipes "How to Write Recipes"
|
||||
[todo]: todo "Todo"
|
||||
[graph-visualisation]: graph-visualisation "Graph visualisation"
|
||||
[backlinking]: backlinking "Backlinking"
|
||||
[unlinked-references]: unlinked-references "Unlinked references (stub)"
|
||||
[reference-lists]: reference-lists "Reference Lists"
|
||||
[wiki-links]: wiki-links "Wiki Links"
|
||||
[link-formatting-and-autocompletion]: link-formatting-and-autocompletion "Link Formatting and Autocompletion"
|
||||
[creating-new-notes]: creating-new-notes "Creating New Notes"
|
||||
[daily-notes]: daily-notes "Daily notes"
|
||||
[diagrams-in-markdown]: diagrams-in-markdown "Diagrams in Markdown"
|
||||
[automatically-expand-urls-to-well-titled-links]: automatically-expand-urls-to-well-titled-links "Automatically Expand URLs to Well-Titled Links"
|
||||
[custom-markdown-preview-styles]: custom-markdown-preview-styles "Custom Markdown Preview Styles"
|
||||
[images-from-your-clipboard]: images-from-your-clipboard "Images from your Clipboard"
|
||||
[good-first-task]: good-first-task "Good First Task"
|
||||
[note-macros]: note-macros "Custom Note Macros"
|
||||
[git-integration]: git-integration "Git integration"
|
||||
[gistpad]: gistpad "GistPad"
|
||||
[github-pages]: github-pages "Github Pages"
|
||||
[gitlab-pages]: gitlab-pages "GitLab Pages"
|
||||
[eleventy-and-netlify]: eleventy-and-netlify "Eleventy and Netlify"
|
||||
[azure-devops-wiki]: azure-devops-wiki "Azure DevOps Wiki"
|
||||
[vercel]: vercel "Vercel"
|
||||
[customising-styles]: customising-styles "Customising Styles"
|
||||
[math-support]: math-support "Math Support"
|
||||
[katex-math-rendering]: katex-math-rendering "Katex Math Rendering"
|
||||
[capture-notes-with-drafts-pro]: capture-notes-with-drafts-pro "Capture Notes With Drafts Pro"
|
||||
[contribution-guide]: contribution-guide.md "Contribution Guide"
|
||||
[how-to-write-recipes]: how-to-write-recipes.md "How to Write Recipes"
|
||||
[todo]: todo.md "Todo"
|
||||
[web-clipper]: web-clipper.md "Web Clipper"
|
||||
[graph-visualisation]: graph-visualisation.md "Graph visualisation"
|
||||
[backlinking]: backlinking.md "Backlinking"
|
||||
[unlinked-references]: unlinked-references.md "Unlinked references (stub)"
|
||||
[reference-lists]: reference-lists.md "Reference Lists"
|
||||
[wiki-links]: wiki-links.md "Wiki Links"
|
||||
[link-formatting-and-autocompletion]: link-formatting-and-autocompletion.md "Link Formatting and Autocompletion"
|
||||
[creating-new-notes]: creating-new-notes.md "Creating New Notes"
|
||||
[daily-notes]: daily-notes.md "Daily notes"
|
||||
[note-macros]: note-macros.md "Custom Note Macros"
|
||||
[diagrams-in-markdown]: diagrams-in-markdown.md "Diagrams in Markdown"
|
||||
[automatically-expand-urls-to-well-titled-links]: automatically-expand-urls-to-well-titled-links.md "Automatically Expand URLs to Well-Titled Links"
|
||||
[custom-markdown-preview-styles]: custom-markdown-preview-styles.md "Custom Markdown Preview Styles"
|
||||
[images-from-your-clipboard]: images-from-your-clipboard.md "Images from your Clipboard"
|
||||
[shows-image-preview-on-hover]: shows-image-preview-on-hover.md "Shows Image Preview on Hover"
|
||||
[good-first-task]: good-first-task.md "Good First Task"
|
||||
[git-integration]: git-integration.md "Git integration"
|
||||
[gistpad]: gistpad.md "GistPad"
|
||||
[github-pages]: github-pages.md "Github Pages"
|
||||
[gitlab-pages]: gitlab-pages.md "GitLab Pages"
|
||||
[eleventy-and-netlify]: eleventy-and-netlify.md "Eleventy and Netlify"
|
||||
[azure-devops-wiki]: azure-devops-wiki.md "Azure DevOps Wiki"
|
||||
[vercel]: vercel.md "Vercel"
|
||||
[customising-styles]: customising-styles.md "Customising Styles"
|
||||
[math-support]: math-support.md "Math Support"
|
||||
[katex-math-rendering]: katex-math-rendering.md "Katex Math Rendering"
|
||||
[capture-notes-with-drafts-pro]: capture-notes-with-drafts-pro.md "Capture Notes With Drafts Pro"
|
||||
[foam-gatsby-template]: foam-gatsby-template.md "Foam Gatsby Template"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Refactoring via Language Server Protocol (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -6,11 +6,11 @@ Use [[backlinking]] for handy reference lists:
|
||||
|
||||
- Add links like [[recommendation]], [[book]] etc.
|
||||
- Create a page by that name and use its back links to see all todo's, recommendations, etc.
|
||||
- Alternatively, higlight the `[[link]]` and `Cmd`+`Shift`+`F` to find all references without creating a page.
|
||||
- Alternatively, highlight the `[[link]]` and `Cmd`+`Shift`+`F` to find all references without creating a page.
|
||||
- [[todo]]: [[materialized-backlinks]] would be very useful here.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[backlinking]: backlinking "Backlinking"
|
||||
[todo]: todo "Todo"
|
||||
[materialized-backlinks]: materialized-backlinks "Materialized Backlinks (stub)"
|
||||
[backlinking]: backlinking.md "Backlinking"
|
||||
[todo]: todo.md "Todo"
|
||||
[materialized-backlinks]: materialized-backlinks.md "Materialized Backlinks (stub)"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
- Can [MDX](https://github.com/mdx-js/mdx) help us here?
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[unlinked-references]: unlinked-references "Unlinked references (stub)"
|
||||
[renaming-files]: renaming-files "Renaming files (stub)"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[unlinked-references]: unlinked-references.md "Unlinked references (stub)"
|
||||
[renaming-files]: renaming-files.md "Renaming files (stub)"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Renaming files (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -15,7 +15,7 @@ Items we plan on working next. Items in this stage don't need to have an owner,
|
||||
If you want to pick up work in this category, you should have a plan on how long the implementation will approximately take so we don't block progress by sitting on high priority issues.
|
||||
|
||||
- [[workspace-janitor]]
|
||||
|
||||
|
||||
## Backlog
|
||||
|
||||
Everything else, categorised into themes. Just because something is on this list doesn't mean it'll get done. If you're interested in working on items in this category, check the [[contribution-guide]] for how to get started.
|
||||
@@ -27,6 +27,7 @@ If a roadmap item is a stub, **consider** opening a [GitHub issue](https://githu
|
||||
### Known issues
|
||||
|
||||
- [[improve-default-workspace-settings]]
|
||||
- Discussion: [foam#270](https://github.com/foambubble/foam/issues/270)
|
||||
- Improve [[git-integration]]
|
||||
- Fix [[wiki-links]] compatibility issues
|
||||
- Simplify [[foam-file-format]]
|
||||
@@ -79,46 +80,46 @@ The community is working on a number of automated scripts to help you migrate to
|
||||
### Integration
|
||||
|
||||
- _Integrations to third party tools_...
|
||||
|
||||
|
||||
### Wild ideas
|
||||
|
||||
- [[foam-linter]]
|
||||
- [[refactoring-via-language-server-protocol]]
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[build-vs-assemble]: build-vs-assemble "Build vs Assemble"
|
||||
[recipes]: recipes "Recipes"
|
||||
[cli]: cli "Command Line Interface"
|
||||
[workspace-janitor]: workspace-janitor "Janitor"
|
||||
[contribution-guide]: contribution-guide "Contribution Guide"
|
||||
[improve-default-workspace-settings]: improve-default-workspace-settings "Improve Default Workspace Settings (stub)"
|
||||
[git-integration]: git-integration "Git integration"
|
||||
[wiki-links]: wiki-links "Wiki Links"
|
||||
[foam-file-format]: foam-file-format "Foam File Format"
|
||||
[renaming-files]: renaming-files "Renaming files (stub)"
|
||||
[unlinked-references]: unlinked-references "Unlinked references (stub)"
|
||||
[block-references]: block-references "Block References (stub)"
|
||||
[improved-backlinking]: improved-backlinking "Improved Backlinking (stub)"
|
||||
[make-backlinks-more-prominent]: make-backlinks-more-prominent "Make Backlinks More Prominent"
|
||||
[materialized-backlinks]: materialized-backlinks "Materialized Backlinks (stub)"
|
||||
[automatic-git-syncing]: automatic-git-syncing "Automatic Git Syncing (stub)"
|
||||
[git-flows-for-teams]: git-flows-for-teams "Git Flows for Teams (stub)"
|
||||
[user-settings]: user-settings "User Settings (stub)"
|
||||
[link-reference-definitions]: link-reference-definitions "Link Reference Definitions"
|
||||
[predefined-user-snippets]: predefined-user-snippets "Pre-defined User Snippets"
|
||||
[officially-support-alternative-templates]: officially-support-alternative-templates "Officially Support Alternative Templates (stub)"
|
||||
[improved-static-site-generation]: improved-static-site-generation "Improved Static Site Generation (stub)"
|
||||
[mdx-by-default]: mdx-by-default "MDX by Default(stub)"
|
||||
[search-in-published-workspace]: search-in-published-workspace "Search in Published Workspace (stub)"
|
||||
[graph-in-published-workspace]: graph-in-published-workspace "Graph in Published Workspace (stub)"
|
||||
[linking-between-published-workspaces]: linking-between-published-workspaces "Linking between Published Workspaces (stub)"
|
||||
[publishing-permissions]: publishing-permissions "Publishing Permissions(stub)"
|
||||
[mobile-apps]: mobile-apps "Mobile Apps"
|
||||
[packaged-desktop-app]: packaged-desktop-app "Packaged Desktop App (stub)"
|
||||
[web-editor]: web-editor "Web Editor (stub)"
|
||||
[migrating-from-roam]: migrating-from-roam "Migrating from Roam (stub)"
|
||||
[migrating-from-obsidian]: migrating-from-obsidian "Migrating from Obsidian (stub)"
|
||||
[migrating-from-onenote]: migrating-from-onenote "Migrating from OneNote"
|
||||
[foam-linter]: foam-linter "Foam Linter (stub)"
|
||||
[refactoring-via-language-server-protocol]: refactoring-via-language-server-protocol "Refactoring via Language Server Protocol (stub)"
|
||||
[build-vs-assemble]: build-vs-assemble.md "Build vs Assemble"
|
||||
[recipes]: recipes.md "Recipes"
|
||||
[cli]: cli.md "Command Line Interface"
|
||||
[workspace-janitor]: workspace-janitor.md "Janitor"
|
||||
[contribution-guide]: contribution-guide.md "Contribution Guide"
|
||||
[improve-default-workspace-settings]: improve-default-workspace-settings.md "Improve Default Workspace Settings (stub)"
|
||||
[git-integration]: git-integration.md "Git integration"
|
||||
[wiki-links]: wiki-links.md "Wiki Links"
|
||||
[foam-file-format]: foam-file-format.md "Foam File Format"
|
||||
[renaming-files]: renaming-files.md "Renaming files (stub)"
|
||||
[unlinked-references]: unlinked-references.md "Unlinked references (stub)"
|
||||
[block-references]: block-references.md "Block References (stub)"
|
||||
[improved-backlinking]: improved-backlinking.md "Improved Backlinking (stub)"
|
||||
[make-backlinks-more-prominent]: make-backlinks-more-prominent.md "Make Backlinks More Prominent"
|
||||
[materialized-backlinks]: materialized-backlinks.md "Materialized Backlinks (stub)"
|
||||
[automatic-git-syncing]: automatic-git-syncing.md "Automatic Git Syncing (stub)"
|
||||
[git-flows-for-teams]: git-flows-for-teams.md "Git Flows for Teams (stub)"
|
||||
[user-settings]: user-settings.md "User Settings (stub)"
|
||||
[link-reference-definitions]: link-reference-definitions.md "Link Reference Definitions"
|
||||
[predefined-user-snippets]: predefined-user-snippets.md "Pre-defined User Snippets"
|
||||
[officially-support-alternative-templates]: officially-support-alternative-templates.md "Officially Support Alternative Templates (stub)"
|
||||
[improved-static-site-generation]: improved-static-site-generation.md "Improved Static Site Generation (stub)"
|
||||
[mdx-by-default]: mdx-by-default.md "MDX by Default(stub)"
|
||||
[search-in-published-workspace]: search-in-published-workspace.md "Search in Published Workspace (stub)"
|
||||
[graph-in-published-workspace]: graph-in-published-workspace.md "Graph in Published Workspace (stub)"
|
||||
[linking-between-published-workspaces]: linking-between-published-workspaces.md "Linking between Published Workspaces (stub)"
|
||||
[publishing-permissions]: publishing-permissions.md "Publishing Permissions(stub)"
|
||||
[mobile-apps]: mobile-apps.md "Mobile Apps"
|
||||
[packaged-desktop-app]: packaged-desktop-app.md "Packaged Desktop App (stub)"
|
||||
[web-editor]: web-editor.md "Web Editor (stub)"
|
||||
[migrating-from-roam]: migrating-from-roam.md "Migrating from Roam (stub)"
|
||||
[migrating-from-obsidian]: migrating-from-obsidian.md "Migrating from Obsidian (stub)"
|
||||
[migrating-from-onenote]: migrating-from-onenote.md "Migrating from OneNote"
|
||||
[foam-linter]: foam-linter.md "Foam Linter (stub)"
|
||||
[refactoring-via-language-server-protocol]: refactoring-via-language-server-protocol.md "Refactoring via Language Server Protocol (stub)"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -7,5 +7,5 @@ Run `Cmd` + `P` ( `Ctrl` + `P` on Windows ) and type a name (like 'issues') to
|
||||
Run `Cmd` + `Shift` + `F` ( `Ctrl` + `Shift` + `F` on Windows ) and type a word (like 'links') to find all the notes that contain that term.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[todo]: todo.md "Todo"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Search in Published Workspace (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
@@ -8,6 +8,6 @@ If you're interested in working on it, please start a conversation in [GitHub is
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
8
docs/shows-image-preview-on-hover.md
Normal file
8
docs/shows-image-preview-on-hover.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Shows Image Preview on Hover
|
||||
|
||||
Use extension: [Image preview](https://marketplace.visualstudio.com/items?itemName=kisstkondoros.vscode-gutter-preview) to shows image preview in the gutter and on hover
|
||||
|
||||
It looks like this
|
||||
|
||||

|
||||

|
||||
@@ -14,6 +14,6 @@ Features belong on the [[roadmap]].
|
||||
For more things to do, check backlinks for Pages that annotate [[todo]].
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[todo]: todo.md "Todo"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Unlinked references (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
@@ -15,6 +15,6 @@ Implementing this is on the [[roadmap]], but for the time being you can achieve
|
||||
- Click any of the references to create a new note.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# User Settings (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -80,6 +80,6 @@ Finally, if all is successful, Vercel will show the detected framework: Jekyll.
|
||||
And now, Vercel will take care of building and rendering our foam workspace each time on push. Vercel will publish our site to `xxx.vercel.app`, we can also define a custom domain name for our Vercel website.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[github-pages]: github-pages "GitHub Pages"
|
||||
[katex-math-rendering]: katex-math-rendering "Katex Math Rendering"
|
||||
[github-pages]: github-pages.md "Github Pages"
|
||||
[katex-math-rendering]: katex-math-rendering.md "Katex Math Rendering"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
14
docs/web-clipper.md
Normal file
14
docs/web-clipper.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Web Clipper
|
||||
|
||||
You can convert any web content into Markdown for storing them in your notes.
|
||||
There are a couple of options when it comes to clipping web pages:
|
||||
|
||||
[Web Clipper - Visual Studio
|
||||
Marketplace](https://marketplace.visualstudio.com/items?itemName=jsartelle.web-clipper)
|
||||
- This is a Web Clipper as a VSCode extension, takes a webpage URL and outputs
|
||||
Markdown. Uses [mercury](https://github.com/postlight/mercury-parser)
|
||||
|
||||
[deathau/markdown-clipper: A Web extension to clip websites and convert them to
|
||||
markdown](https://github.com/deathau/markdown-clipper) - This is a Web Extension
|
||||
that can be used in multiple browsers to the extract any webpage's content in
|
||||
markdown.
|
||||
@@ -1,10 +1,10 @@
|
||||
# Web Editor (stub)
|
||||
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
**[[todo]] This [[roadmap]] item needs more specification work.**
|
||||
|
||||
If you're interested in working on it, please start a conversation in [GitHub issues](https://github.com/foambubble/foam/issues).
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[todo]: todo "Todo"
|
||||
[roadmap]: roadmap "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
[todo]: todo.md "Todo"
|
||||
[roadmap]: roadmap.md "Roadmap"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Foam enables you to Link pages together using `[[file-name]]` annotations (i.e. `[[media-wiki]]` links).
|
||||
|
||||
- Type `[[` and start typing a file name for autocompletion.
|
||||
- Note that your file names should be in `lower-dash-case.md`, and your wiki links should reference file names exactly: `[[lower-dash-case]]`, not `[[Lower Dash Case]]`.
|
||||
- Note that your file names should be in `lower-dash-case.md`, and your wiki links should reference file names exactly: `[[lower-dash-case]]`, not `[[Lower Dash Case]]`.
|
||||
- See [[link-formatting-and-autocompletion]] for more information, and how to setup your link autocompletions to make this easier.
|
||||
- `Cmd` + `Click` ( `Ctrl` + `Click` on Windows ) on file name to navigate to file (`F12` also works while your cursor is on the file name)
|
||||
- `Cmd` + `Click` ( `Ctrl` + `Click` on Windows ) on non-existent file to create that file in the workspace.
|
||||
@@ -26,8 +26,8 @@ The [Foam for VSCode](https://marketplace.visualstudio.com/items?itemName=foam.f
|
||||
- See [[link-reference-definition-improvements]] for further discussion on current problems and potential solutions.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[link-formatting-and-autocompletion]: link-formatting-and-autocompletion "Link Formatting and Autocompletion"
|
||||
[link-reference-definitions]: link-reference-definitions "Link Reference Definitions"
|
||||
[foam-file-format]: foam-file-format "Foam File Format"
|
||||
[link-reference-definition-improvements]: link-reference-definition-improvements "Link Reference Definition Improvements"
|
||||
[link-formatting-and-autocompletion]: link-formatting-and-autocompletion.md "Link Formatting and Autocompletion"
|
||||
[link-reference-definitions]: link-reference-definitions.md "Link Reference Definitions"
|
||||
[foam-file-format]: foam-file-format.md "Foam File Format"
|
||||
[link-reference-definition-improvements]: link-reference-definition-improvements.md "Link Reference Definition Improvements"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -30,11 +30,11 @@ The Janitor can be installed from [NPM](https://www.npmjs.com/) and executed as
|
||||
> foam janitor path/to/workspace
|
||||
```
|
||||
|
||||
You can run the Janitor as a git hook on every commit to ensure your workspace links are up to date. This can be especially helpful if you edit your markdown documents from other apps.
|
||||
You can run the Janitor as a git hook on every commit to ensure your workspace links are up to date. This can be especially helpful if you edit your markdown documents from other apps.
|
||||
|
||||
You can also run the Janitor from a GitHub action to ensure that all changes coming to your workspace are up to date. This can be useful when editing your Foam notes from mobile (i.e. via [GitJournal](https://gitjournal.io)), or your Foam has multiple contributors and you want to ensure that all changes are correctly integrated.
|
||||
|
||||
[//begin]: # "Autogenerated link references for markdown compatibility"
|
||||
[link-reference-definitions]: link-reference-definitions "Link Reference Definitions"
|
||||
[materialized-backlinks]: materialized-backlinks "Materialized Backlinks (stub)"
|
||||
[link-reference-definitions]: link-reference-definitions.md "Link Reference Definitions"
|
||||
[materialized-backlinks]: materialized-backlinks.md "Materialized Backlinks (stub)"
|
||||
[//end]: # "Autogenerated link references"
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
],
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"version": "0.3.1"
|
||||
"version": "0.5.0"
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ $ npm install -g foam-cli
|
||||
$ foam COMMAND
|
||||
running command...
|
||||
$ foam (-v|--version|version)
|
||||
foam-cli/0.3.0 darwin-x64 node-v12.18.0
|
||||
foam-cli/0.5.0 darwin-x64 node-v10.19.0
|
||||
$ foam --help [COMMAND]
|
||||
USAGE
|
||||
$ foam COMMAND
|
||||
@@ -65,7 +65,7 @@ EXAMPLE
|
||||
$ foam-cli janitor path-to-foam-workspace
|
||||
```
|
||||
|
||||
_See code: [src/commands/janitor.ts](https://github.com/foambubble/foam/blob/v0.3.0/src/commands/janitor.ts)_
|
||||
_See code: [src/commands/janitor.ts](https://github.com/foambubble/foam/blob/v0.5.0/src/commands/janitor.ts)_
|
||||
|
||||
## `foam migrate [WORKSPACEPATH]`
|
||||
|
||||
@@ -84,7 +84,7 @@ EXAMPLE
|
||||
Successfully generated link references and heading!
|
||||
```
|
||||
|
||||
_See code: [src/commands/migrate.ts](https://github.com/foambubble/foam/blob/v0.3.0/src/commands/migrate.ts)_
|
||||
_See code: [src/commands/migrate.ts](https://github.com/foambubble/foam/blob/v0.5.0/src/commands/migrate.ts)_
|
||||
<!-- commandsstop -->
|
||||
|
||||
## Development
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "foam-cli",
|
||||
"description": "Foam CLI",
|
||||
"version": "0.3.0",
|
||||
"version": "0.5.0",
|
||||
"author": "Jani Eväkallio @jevakallio",
|
||||
"bin": {
|
||||
"foam": "./bin/run"
|
||||
@@ -11,7 +11,7 @@
|
||||
"@oclif/command": "^1",
|
||||
"@oclif/config": "^1",
|
||||
"@oclif/plugin-help": "^3",
|
||||
"foam-core": "^0.3.0",
|
||||
"foam-core": "^0.5.0",
|
||||
"ora": "^4.0.4",
|
||||
"tslib": "^1"
|
||||
},
|
||||
@@ -33,7 +33,7 @@
|
||||
"typescript": "^3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"foam-core": "^0.2.0"
|
||||
"foam-core": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { Command, flags } from '@oclif/command';
|
||||
import * as ora from 'ora';
|
||||
import ora from 'ora';
|
||||
import {
|
||||
initializeNoteGraph,
|
||||
bootstrap,
|
||||
createConfigFromFolders,
|
||||
generateLinkReferences,
|
||||
generateHeading,
|
||||
applyTextEdit
|
||||
applyTextEdit,
|
||||
} from 'foam-core';
|
||||
import { writeFileToDisk } from '../utils/write-file-to-disk';
|
||||
import { isValidDirectory } from '../utils';
|
||||
@@ -21,7 +22,8 @@ export default class Janitor extends Command {
|
||||
static flags = {
|
||||
'without-extensions': flags.boolean({
|
||||
char: 'w',
|
||||
description: 'generate link reference definitions without extensions (for legacy support)'
|
||||
description:
|
||||
'generate link reference definitions without extensions (for legacy support)',
|
||||
}),
|
||||
help: flags.help({ char: 'h' }),
|
||||
};
|
||||
@@ -36,7 +38,8 @@ export default class Janitor extends Command {
|
||||
const { workspacePath = './' } = args;
|
||||
|
||||
if (isValidDirectory(workspacePath)) {
|
||||
const graph = await initializeNoteGraph(workspacePath);
|
||||
const graph = (await bootstrap(createConfigFromFolders([workspacePath])))
|
||||
.notes;
|
||||
|
||||
const notes = graph.getNotes().filter(Boolean); // removes undefined notes
|
||||
|
||||
@@ -54,7 +57,11 @@ export default class Janitor extends Command {
|
||||
const fileWritePromises = notes.map(note => {
|
||||
// Get edits
|
||||
const heading = generateHeading(note);
|
||||
const definitions = generateLinkReferences(note, graph, !flags['without-extensions']);
|
||||
const definitions = generateLinkReferences(
|
||||
note,
|
||||
graph,
|
||||
!flags['without-extensions']
|
||||
);
|
||||
|
||||
// apply Edits
|
||||
let file = note.source.text;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Command, flags } from '@oclif/command';
|
||||
import * as ora from 'ora';
|
||||
import ora from 'ora';
|
||||
import {
|
||||
initializeNoteGraph,
|
||||
bootstrap,
|
||||
createConfigFromFolders,
|
||||
generateLinkReferences,
|
||||
generateHeading,
|
||||
getKebabCaseFileName,
|
||||
applyTextEdit
|
||||
applyTextEdit,
|
||||
} from 'foam-core';
|
||||
import { writeFileToDisk } from '../utils/write-file-to-disk';
|
||||
import { renameFile } from '../utils/rename-file';
|
||||
@@ -25,7 +26,8 @@ Successfully generated link references and heading!
|
||||
static flags = {
|
||||
'without-extensions': flags.boolean({
|
||||
char: 'w',
|
||||
description: 'generate link reference definitions without extensions (for legacy support)'
|
||||
description:
|
||||
'generate link reference definitions without extensions (for legacy support)',
|
||||
}),
|
||||
help: flags.help({ char: 'h' }),
|
||||
};
|
||||
@@ -38,9 +40,10 @@ Successfully generated link references and heading!
|
||||
const { args, flags } = this.parse(Migrate);
|
||||
|
||||
const { workspacePath = './' } = args;
|
||||
const config = createConfigFromFolders([workspacePath]);
|
||||
|
||||
if (isValidDirectory(workspacePath)) {
|
||||
let graph = await initializeNoteGraph(workspacePath);
|
||||
let graph = (await bootstrap(config)).notes;
|
||||
|
||||
let notes = graph.getNotes().filter(Boolean); // removes undefined notes
|
||||
|
||||
@@ -69,7 +72,7 @@ Successfully generated link references and heading!
|
||||
spinner.text = 'Renaming files';
|
||||
|
||||
// Reinitialize the graph after renaming files
|
||||
graph = await initializeNoteGraph(workspacePath);
|
||||
graph = (await bootstrap(config)).notes;
|
||||
|
||||
notes = graph.getNotes().filter(Boolean); // remove undefined notes
|
||||
|
||||
@@ -80,7 +83,11 @@ Successfully generated link references and heading!
|
||||
notes.map(note => {
|
||||
// Get edits
|
||||
const heading = generateHeading(note);
|
||||
const definitions = generateLinkReferences(note, graph, !flags['without-extensions']);
|
||||
const definitions = generateLinkReferences(
|
||||
note,
|
||||
graph,
|
||||
!flags['without-extensions']
|
||||
);
|
||||
|
||||
// apply Edits
|
||||
let file = note.source.text;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"outDir": "lib",
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"target": "es2017"
|
||||
},
|
||||
"include": [
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "foam-core",
|
||||
"author": "Jani Eväkallio",
|
||||
"repository": "https://github.com/foambubble/foam",
|
||||
"version": "0.3.0",
|
||||
"version": "0.5.0",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist"
|
||||
@@ -13,12 +13,13 @@
|
||||
"test": "tsdx test",
|
||||
"lint": "tsdx lint src test",
|
||||
"watch": "tsdx watch",
|
||||
"prepare": "tsdx build"
|
||||
"prepare": "tsdx build --tsconfig ./tsconfig.build.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/github-slugger": "^1.3.0",
|
||||
"@types/graphlib": "^2.1.6",
|
||||
"@types/lodash": "^4.14.157",
|
||||
"@types/string.prototype.matchall": "^4.0.0",
|
||||
"husky": "^4.2.5",
|
||||
"tsdx": "^0.13.2",
|
||||
"tslib": "^2.0.0",
|
||||
@@ -33,6 +34,7 @@
|
||||
"remark-frontmatter": "^2.0.0",
|
||||
"remark-parse": "^8.0.2",
|
||||
"remark-wiki-link": "^0.0.4",
|
||||
"string.prototype.matchall": "^4.0.2",
|
||||
"title-case": "^3.0.2",
|
||||
"unified": "^9.0.0",
|
||||
"unist-util-visit": "^2.0.2",
|
||||
|
||||
59
packages/foam-core/src/bootstrap.ts
Normal file
59
packages/foam-core/src/bootstrap.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import glob from 'glob';
|
||||
import { promisify } from 'util';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import detectNewline from 'detect-newline';
|
||||
import { createGraph, NoteGraphAPI } from './note-graph';
|
||||
import { createMarkdownParser } from './markdown-provider';
|
||||
import { FoamConfig, Foam } from './index';
|
||||
import { loadPlugins } from './plugins';
|
||||
import { isNotNull } from './utils';
|
||||
import { NoteParser } from './types';
|
||||
|
||||
const findAllFiles = promisify(glob);
|
||||
|
||||
const loadNoteGraph = (
|
||||
graph: NoteGraphAPI,
|
||||
parser: NoteParser,
|
||||
files: string[]
|
||||
) => {
|
||||
return Promise.all(
|
||||
files.map(f => {
|
||||
return fs.promises.readFile(f).then(data => {
|
||||
const markdown = (data || '').toString();
|
||||
const eol = detectNewline(markdown) || os.EOL;
|
||||
graph.setNote(parser.parse(f, markdown, eol));
|
||||
});
|
||||
})
|
||||
).then(() => graph);
|
||||
};
|
||||
|
||||
export const bootstrap = async (config: FoamConfig) => {
|
||||
const plugins = await loadPlugins(config);
|
||||
const middlewares = plugins
|
||||
.map(p => p.graphMiddleware || null)
|
||||
.filter(isNotNull);
|
||||
const parserPlugins = plugins.map(p => p.parser || null).filter(isNotNull);
|
||||
|
||||
const parser = createMarkdownParser(parserPlugins);
|
||||
const files = await Promise.all(
|
||||
config.workspaceFolders.map(folder => {
|
||||
if (folder.substr(-1) === '/') {
|
||||
folder = folder.slice(0, -1);
|
||||
}
|
||||
return findAllFiles(`${folder}/**/*.md`, {});
|
||||
})
|
||||
);
|
||||
|
||||
const graph = await loadNoteGraph(
|
||||
createGraph(middlewares),
|
||||
parser,
|
||||
([] as string[]).concat(...files)
|
||||
);
|
||||
|
||||
return {
|
||||
notes: graph,
|
||||
config: config,
|
||||
parse: parser.parse,
|
||||
} as Foam;
|
||||
};
|
||||
54
packages/foam-core/src/config.ts
Normal file
54
packages/foam-core/src/config.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { readFileSync } from 'fs';
|
||||
import { merge } from 'lodash';
|
||||
|
||||
export interface FoamConfig {
|
||||
workspaceFolders: string[];
|
||||
get<T>(path: string): T | undefined;
|
||||
get<T>(path: string, defaultValue: T): T;
|
||||
}
|
||||
|
||||
export const createConfigFromObject = (
|
||||
workspaceFolders: string[],
|
||||
settings: any
|
||||
) => {
|
||||
const config: FoamConfig = {
|
||||
workspaceFolders: workspaceFolders,
|
||||
get: <T>(path: string, defaultValue?: T) => {
|
||||
const tokens = path.split('.');
|
||||
const value = tokens.reduce((acc, t) => acc?.[t], settings);
|
||||
return value ?? defaultValue;
|
||||
},
|
||||
};
|
||||
return config;
|
||||
};
|
||||
|
||||
export const createConfigFromFolders = (
|
||||
workspaceFolders: string[] | string
|
||||
): FoamConfig => {
|
||||
if (!Array.isArray(workspaceFolders)) {
|
||||
workspaceFolders = [workspaceFolders];
|
||||
}
|
||||
const workspaceConfig: any = workspaceFolders.reduce(
|
||||
(acc, f) => merge(acc, parseConfig(`${f}/config.json`)),
|
||||
{}
|
||||
);
|
||||
// For security reasons local plugins can only be
|
||||
// activated via user config
|
||||
if ('experimental' in workspaceConfig) {
|
||||
delete workspaceConfig['experimental']['localPlugins'];
|
||||
}
|
||||
|
||||
const userConfig = parseConfig(`~/.foam/config.json`);
|
||||
|
||||
const settings = merge(workspaceConfig, userConfig);
|
||||
|
||||
return createConfigFromObject(workspaceFolders, settings);
|
||||
};
|
||||
|
||||
const parseConfig = (path: string) => {
|
||||
try {
|
||||
return JSON.parse(readFileSync(path, 'utf8'));
|
||||
} catch {
|
||||
console.warn('Could not read configuration from ' + path);
|
||||
}
|
||||
};
|
||||
@@ -1,7 +1,10 @@
|
||||
import { NoteGraph, Note, NoteLink } from './note-graph';
|
||||
import { Note, NoteLink } from './types';
|
||||
import { NoteGraph, NoteGraphAPI } from './note-graph';
|
||||
import { FoamConfig } from './config';
|
||||
|
||||
export { FoamConfig };
|
||||
|
||||
export {
|
||||
createNoteFromMarkdown,
|
||||
createMarkdownReferences,
|
||||
stringifyMarkdownLinkReferenceDefinition,
|
||||
} from './markdown-provider';
|
||||
@@ -15,25 +18,19 @@ export {
|
||||
|
||||
export { applyTextEdit } from './janitor/apply-text-edit';
|
||||
|
||||
export { initializeNoteGraph } from './initialize-note-graph';
|
||||
export { createConfigFromFolders } from './config';
|
||||
|
||||
export { NoteGraph, Note, NoteLink };
|
||||
export { bootstrap } from './bootstrap';
|
||||
|
||||
export { NoteGraph, NoteGraphAPI, Note, NoteLink };
|
||||
|
||||
export {
|
||||
LINK_REFERENCE_DEFINITION_HEADER,
|
||||
LINK_REFERENCE_DEFINITION_FOOTER,
|
||||
} from './definitions';
|
||||
|
||||
export interface FoamConfig {
|
||||
// TODO
|
||||
}
|
||||
|
||||
export interface Foam {
|
||||
notes: NoteGraph;
|
||||
// config: FoamConfig
|
||||
notes: NoteGraphAPI;
|
||||
config: FoamConfig;
|
||||
parse: (uri: string, text: string, eol: string) => Note;
|
||||
}
|
||||
|
||||
export const createFoam = (config: FoamConfig) => ({
|
||||
notes: new NoteGraph(),
|
||||
config: config,
|
||||
});
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import glob from 'glob';
|
||||
import { promisify } from 'util';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import detectNewline from 'detect-newline';
|
||||
import { NoteGraph } from './note-graph';
|
||||
import { createNoteFromMarkdown } from './markdown-provider';
|
||||
|
||||
const findAllFiles = promisify(glob);
|
||||
|
||||
export const initializeNoteGraph = async (workspacePath: string) => {
|
||||
// remove trailing slash from workspacePath if exists
|
||||
if (workspacePath.substr(-1) === '/')
|
||||
workspacePath = workspacePath.slice(0, -1);
|
||||
|
||||
const files = await findAllFiles(`${workspacePath}/**/*.md`, {});
|
||||
|
||||
const graph = new NoteGraph();
|
||||
await Promise.all(
|
||||
(await files).map(f => {
|
||||
return fs.promises.readFile(f).then(data => {
|
||||
const markdown = (data || '').toString();
|
||||
const eol = detectNewline(markdown) || os.EOL;
|
||||
graph.setNote(createNoteFromMarkdown(f, markdown, eol));
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
return graph;
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Position } from 'unist';
|
||||
import GithubSlugger from 'github-slugger';
|
||||
import { Note, GraphNote, NoteGraph } from '../note-graph';
|
||||
import { GraphNote, NoteGraphAPI } from '../note-graph';
|
||||
import { Note } from '../types';
|
||||
import {
|
||||
LINK_REFERENCE_DEFINITION_HEADER,
|
||||
LINK_REFERENCE_DEFINITION_FOOTER,
|
||||
@@ -20,7 +21,7 @@ export interface TextEdit {
|
||||
|
||||
export const generateLinkReferences = (
|
||||
note: GraphNote,
|
||||
ng: NoteGraph,
|
||||
ng: NoteGraphAPI,
|
||||
includeExtensions: boolean
|
||||
): TextEdit | null => {
|
||||
if (!note) {
|
||||
@@ -85,6 +86,12 @@ export const generateHeading = (note: Note): TextEdit | null => {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO now the note.title defaults to file name at parsing time, so this check
|
||||
// doesn't work anymore. Decide:
|
||||
// - whether do we actually want to continue generate the headings
|
||||
// - whether it should be under a config option
|
||||
// A possible approach would be around having a `sections` field in the note, and inspect
|
||||
// it to see if there is an h1 title. Alternatively parse directly the markdown in this function.
|
||||
if (note.title) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3,91 +3,195 @@ import markdownParse from 'remark-parse';
|
||||
import wikiLinkPlugin from 'remark-wiki-link';
|
||||
import frontmatterPlugin from 'remark-frontmatter';
|
||||
import { parse as parseYAML } from 'yaml';
|
||||
import visit, { CONTINUE, EXIT } from 'unist-util-visit';
|
||||
import { Node, Parent, Point } from 'unist';
|
||||
import visit from 'unist-util-visit';
|
||||
import { Parent, Point } from 'unist';
|
||||
import * as path from 'path';
|
||||
import { NoteLink, NoteLinkDefinition, NoteGraph, Note } from './note-graph';
|
||||
import { dropExtension, uriToSlug } from './utils';
|
||||
import { NoteGraphAPI } from './note-graph';
|
||||
import { NoteLinkDefinition, Note, NoteParser } from './types';
|
||||
import {
|
||||
dropExtension,
|
||||
uriToSlug,
|
||||
extractHashtags,
|
||||
extractTagsFromProp,
|
||||
} from './utils';
|
||||
import { ID } from './types';
|
||||
import { ParserPlugin } from './plugins';
|
||||
|
||||
let processor: unified.Processor | null = null;
|
||||
const tagsPlugin: ParserPlugin = {
|
||||
name: 'tags',
|
||||
onWillVisitTree: (tree, note) => {
|
||||
note.tags = extractHashtags(note.source.text);
|
||||
},
|
||||
onDidFindProperties: (props, note) => {
|
||||
const yamlTags = extractTagsFromProp(props.tags);
|
||||
yamlTags.forEach(tag => note.tags.add(tag));
|
||||
},
|
||||
};
|
||||
|
||||
function parse(markdown: string): Node {
|
||||
processor =
|
||||
processor ||
|
||||
unified()
|
||||
.use(markdownParse, { gfm: true })
|
||||
.use(frontmatterPlugin, ['yaml'])
|
||||
.use(wikiLinkPlugin);
|
||||
return processor.parse(markdown);
|
||||
}
|
||||
|
||||
export function createNoteFromMarkdown(
|
||||
uri: string,
|
||||
markdown: string,
|
||||
eol: string
|
||||
): Note {
|
||||
const tree = parse(markdown);
|
||||
let title: string | null = null;
|
||||
|
||||
visit(tree, node => {
|
||||
if (node.type === 'heading' && node.depth === 1) {
|
||||
title = ((node as Parent)!.children[0].value as string) || title;
|
||||
const titlePlugin: ParserPlugin = {
|
||||
name: 'title',
|
||||
visit: (node, note) => {
|
||||
if (note.title == null && node.type === 'heading' && node.depth === 1) {
|
||||
note.title =
|
||||
((node as Parent)!.children?.[0]?.value as string) || note.title;
|
||||
}
|
||||
return title === null ? CONTINUE : EXIT;
|
||||
});
|
||||
|
||||
const links: NoteLink[] = [];
|
||||
const linkDefinitions: NoteLinkDefinition[] = [];
|
||||
let frontmatter: any = {};
|
||||
let start: Point = { line: 1, column: 1, offset: 0 }; // start position of the note
|
||||
visit(tree, node => {
|
||||
if (node.type === 'yaml') {
|
||||
frontmatter = parseYAML(node.value as string) ?? {}; // parseYAML returns null if the frontmatter is empty
|
||||
// Update the start position of the note by exluding the metadata
|
||||
start = {
|
||||
line: node.position!.end.line! + 1,
|
||||
column: 1,
|
||||
offset: node.position!.end.offset! + 1,
|
||||
};
|
||||
},
|
||||
onDidFindProperties: (props, note) => {
|
||||
// Give precendence to the title from the frontmatter if it exists
|
||||
note.title = props.title ?? note.title;
|
||||
},
|
||||
onDidVisitTree: (tree, note) => {
|
||||
if (note.title == null) {
|
||||
note.title = path.parse(note.source.uri).name;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const wikilinkPlugin: ParserPlugin = {
|
||||
name: 'wikilink',
|
||||
visit: (node, note) => {
|
||||
if (node.type === 'wikiLink') {
|
||||
links.push({
|
||||
note.links.push({
|
||||
type: 'wikilink',
|
||||
slug: node.value as string,
|
||||
position: node.position!,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const definitionsPlugin: ParserPlugin = {
|
||||
name: 'definitions',
|
||||
visit: (node, note) => {
|
||||
if (node.type === 'definition') {
|
||||
linkDefinitions.push({
|
||||
note.definitions.push({
|
||||
label: node.label as string,
|
||||
url: node.url as string,
|
||||
title: node.title as string,
|
||||
position: node.position,
|
||||
});
|
||||
}
|
||||
},
|
||||
onDidVisitTree: (tree, note) => {
|
||||
note.definitions = getFoamDefinitions(note.definitions, note.source.end);
|
||||
},
|
||||
};
|
||||
|
||||
const handleError = (
|
||||
plugin: ParserPlugin,
|
||||
fnName: string,
|
||||
uri: string | undefined,
|
||||
e: Error
|
||||
): void => {
|
||||
const name = plugin.name || '';
|
||||
console.warn(
|
||||
`Error while executing [${fnName}] in plugin [${name}] for file [${uri}]`,
|
||||
e
|
||||
);
|
||||
};
|
||||
|
||||
export function createMarkdownParser(extraPlugins: ParserPlugin[]): NoteParser {
|
||||
const parser = unified()
|
||||
.use(markdownParse, { gfm: true })
|
||||
.use(frontmatterPlugin, ['yaml'])
|
||||
.use(wikiLinkPlugin);
|
||||
|
||||
const plugins = [
|
||||
titlePlugin,
|
||||
wikilinkPlugin,
|
||||
definitionsPlugin,
|
||||
tagsPlugin,
|
||||
...extraPlugins,
|
||||
];
|
||||
|
||||
plugins.forEach(plugin => {
|
||||
try {
|
||||
plugin.onDidInitializeParser?.(parser);
|
||||
} catch (e) {
|
||||
handleError(plugin, 'onDidInitializeParser', undefined, e);
|
||||
}
|
||||
});
|
||||
|
||||
// Give precendence to the title from the frontmatter if it exists
|
||||
title = frontmatter.title ?? title;
|
||||
|
||||
const end = tree.position!.end;
|
||||
const definitions = getFoamDefinitions(linkDefinitions, end);
|
||||
|
||||
return {
|
||||
properties: frontmatter,
|
||||
slug: uriToSlug(uri),
|
||||
title: title,
|
||||
links: links,
|
||||
definitions: definitions,
|
||||
source: {
|
||||
uri: uri,
|
||||
text: markdown,
|
||||
contentStart: start,
|
||||
end: end,
|
||||
eol: eol,
|
||||
parse: (uri: string, markdown: string, eol: string): Note => {
|
||||
markdown = plugins.reduce((acc, plugin) => {
|
||||
try {
|
||||
return plugin.onWillParseMarkdown?.(acc) || acc;
|
||||
} catch (e) {
|
||||
handleError(plugin, 'onWillParseMarkdown', uri, e);
|
||||
return acc;
|
||||
}
|
||||
}, markdown);
|
||||
const tree = parser.parse(markdown);
|
||||
|
||||
var note: Note = {
|
||||
slug: uriToSlug(uri),
|
||||
properties: {},
|
||||
title: null,
|
||||
tags: new Set(),
|
||||
links: [],
|
||||
definitions: [],
|
||||
source: {
|
||||
uri: uri,
|
||||
text: markdown,
|
||||
contentStart: tree.position!.start,
|
||||
end: tree.position!.end,
|
||||
eol: eol,
|
||||
},
|
||||
};
|
||||
|
||||
plugins.forEach(plugin => {
|
||||
try {
|
||||
plugin.onWillVisitTree?.(tree, note);
|
||||
} catch (e) {
|
||||
handleError(plugin, 'onWillVisitTree', uri, e);
|
||||
}
|
||||
});
|
||||
visit(tree, node => {
|
||||
if (node.type === 'yaml') {
|
||||
try {
|
||||
const yamlProperties = parseYAML(node.value as string) ?? {};
|
||||
note.properties = {
|
||||
...note.properties,
|
||||
...yamlProperties,
|
||||
};
|
||||
// Give precendence to the title from the frontmatter if it exists
|
||||
note.title = note.properties.title ?? note.title;
|
||||
// Update the start position of the note by exluding the metadata
|
||||
note.source.contentStart = {
|
||||
line: node.position!.end.line! + 1,
|
||||
column: 1,
|
||||
offset: node.position!.end.offset! + 1,
|
||||
};
|
||||
|
||||
for (let i = 0, len = plugins.length; i < len; i++) {
|
||||
try {
|
||||
plugins[i].onDidFindProperties?.(yamlProperties, note);
|
||||
} catch (e) {
|
||||
handleError(plugins[i], 'onDidFindProperties', uri, e);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(`Error while parsing YAML for [${uri}]`, e);
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0, len = plugins.length; i < len; i++) {
|
||||
try {
|
||||
plugins[i].visit?.(node, note);
|
||||
} catch (e) {
|
||||
handleError(plugins[i], 'visit', uri, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
plugins.forEach(plugin => {
|
||||
try {
|
||||
plugin.onDidVisitTree?.(tree, note);
|
||||
} catch (e) {
|
||||
handleError(plugin, 'onDidVisitTree', uri, e);
|
||||
}
|
||||
});
|
||||
return note;
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -128,7 +232,7 @@ export function stringifyMarkdownLinkReferenceDefinition(
|
||||
return text;
|
||||
}
|
||||
export function createMarkdownReferences(
|
||||
graph: NoteGraph,
|
||||
graph: NoteGraphAPI,
|
||||
noteId: ID,
|
||||
includeExtension: boolean
|
||||
): NoteLinkDefinition[] {
|
||||
|
||||
@@ -1,42 +1,7 @@
|
||||
import { Graph } from 'graphlib';
|
||||
import { EventEmitter } from 'events';
|
||||
import { Position, Point, URI, ID } from './types';
|
||||
import { hashURI, computeRelativeURI } from './utils';
|
||||
|
||||
export interface NoteSource {
|
||||
uri: URI;
|
||||
text: string;
|
||||
contentStart: Point;
|
||||
end: Point;
|
||||
eol: string;
|
||||
}
|
||||
|
||||
export interface WikiLink {
|
||||
type: 'wikilink';
|
||||
slug: string;
|
||||
position: Position;
|
||||
}
|
||||
|
||||
// at the moment we only model wikilink
|
||||
export type NoteLink = WikiLink;
|
||||
|
||||
export interface NoteLinkDefinition {
|
||||
label: string;
|
||||
url: string;
|
||||
title?: string;
|
||||
position?: Position;
|
||||
}
|
||||
|
||||
export interface Note {
|
||||
title: string | null;
|
||||
slug: string; // note: this slug is not necessarily unique
|
||||
properties: object;
|
||||
// sections: NoteSection[]
|
||||
// tags: NoteTag[]
|
||||
links: NoteLink[];
|
||||
definitions: NoteLinkDefinition[];
|
||||
source: NoteSource;
|
||||
}
|
||||
import { URI, ID, Note, NoteLink } from './types';
|
||||
import { computeRelativeURI } from './utils';
|
||||
|
||||
export type GraphNote = Note & {
|
||||
id: ID;
|
||||
@@ -52,7 +17,27 @@ export type NoteGraphEventHandler = (e: { note: GraphNote }) => void;
|
||||
|
||||
export type NotesQuery = { slug: string } | { title: string };
|
||||
|
||||
export class NoteGraph {
|
||||
export interface NoteGraphAPI {
|
||||
setNote(note: Note): GraphNote;
|
||||
getNotes(query?: NotesQuery): GraphNote[];
|
||||
getNote(noteId: ID): GraphNote | null;
|
||||
getNoteByURI(uri: URI): GraphNote | null;
|
||||
getAllLinks(noteId: ID): GraphConnection[];
|
||||
getForwardLinks(noteId: ID): GraphConnection[];
|
||||
getBacklinks(noteId: ID): GraphConnection[];
|
||||
unstable_onNoteAdded(callback: NoteGraphEventHandler): void;
|
||||
unstable_onNoteUpdated(callback: NoteGraphEventHandler): void;
|
||||
unstable_removeEventListener(callback: NoteGraphEventHandler): void;
|
||||
}
|
||||
|
||||
export type Middleware = (next: NoteGraphAPI) => Partial<NoteGraphAPI>;
|
||||
|
||||
export const createGraph = (middlewares: Middleware[]): NoteGraphAPI => {
|
||||
const graph: NoteGraphAPI = new NoteGraph();
|
||||
return middlewares.reduce((acc, m) => backfill(acc, m), graph);
|
||||
};
|
||||
|
||||
export class NoteGraph implements NoteGraphAPI {
|
||||
private graph: Graph;
|
||||
private events: EventEmitter;
|
||||
private createIdFromURI: (uri: URI) => ID;
|
||||
@@ -60,7 +45,7 @@ export class NoteGraph {
|
||||
constructor() {
|
||||
this.graph = new Graph();
|
||||
this.events = new EventEmitter();
|
||||
this.createIdFromURI = hashURI;
|
||||
this.createIdFromURI = uri => uri;
|
||||
}
|
||||
|
||||
public setNote(note: Note): GraphNote {
|
||||
@@ -149,3 +134,19 @@ export class NoteGraph {
|
||||
this.events.removeAllListeners();
|
||||
}
|
||||
}
|
||||
|
||||
const backfill = (next: NoteGraphAPI, middleware: Middleware): NoteGraphAPI => {
|
||||
const m = middleware(next);
|
||||
return {
|
||||
setNote: m.setNote || next.setNote,
|
||||
getNotes: m.getNotes || next.getNotes,
|
||||
getNote: m.getNote || next.getNote,
|
||||
getNoteByURI: m.getNoteByURI || next.getNoteByURI,
|
||||
getAllLinks: m.getAllLinks || next.getAllLinks,
|
||||
getForwardLinks: m.getForwardLinks || next.getForwardLinks,
|
||||
getBacklinks: m.getBacklinks || next.getBacklinks,
|
||||
unstable_onNoteAdded: next.unstable_onNoteAdded.bind(next),
|
||||
unstable_onNoteUpdated: next.unstable_onNoteUpdated.bind(next),
|
||||
unstable_removeEventListener: next.unstable_removeEventListener.bind(next),
|
||||
};
|
||||
};
|
||||
|
||||
81
packages/foam-core/src/plugins/index.ts
Normal file
81
packages/foam-core/src/plugins/index.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import * as fs from 'fs';
|
||||
import path from 'path';
|
||||
import { Node } from 'unist';
|
||||
import { isNotNull } from '../utils';
|
||||
import { Middleware } from '../note-graph';
|
||||
import { Note } from '../types';
|
||||
import unified from 'unified';
|
||||
import { FoamConfig } from '../config';
|
||||
|
||||
export interface FoamPlugin {
|
||||
name: string;
|
||||
description?: string;
|
||||
graphMiddleware?: Middleware;
|
||||
parser?: ParserPlugin;
|
||||
}
|
||||
|
||||
export interface ParserPlugin {
|
||||
name?: string;
|
||||
visit?: (node: Node, note: Note) => void;
|
||||
onDidInitializeParser?: (parser: unified.Processor) => void;
|
||||
onWillParseMarkdown?: (markdown: string) => string;
|
||||
onWillVisitTree?: (tree: Node, note: Note) => void;
|
||||
onDidVisitTree?: (tree: Node, note: Note) => void;
|
||||
onDidFindProperties?: (properties: any, note: Note) => void;
|
||||
}
|
||||
|
||||
export interface PluginConfig {
|
||||
enabled?: boolean;
|
||||
pluginFolders?: string[];
|
||||
}
|
||||
|
||||
export const SETTINGS_PATH = 'experimental.localPlugins';
|
||||
|
||||
export async function loadPlugins(config: FoamConfig): Promise<FoamPlugin[]> {
|
||||
const pluginConfig = config.get<PluginConfig>(SETTINGS_PATH, {});
|
||||
const isFeatureEnabled = pluginConfig.enabled ?? false;
|
||||
if (!isFeatureEnabled) {
|
||||
return [];
|
||||
}
|
||||
const pluginDirs: string[] =
|
||||
pluginConfig.pluginFolders ?? findPluginDirs(config.workspaceFolders);
|
||||
|
||||
const plugins = await Promise.all(
|
||||
pluginDirs
|
||||
.filter(dir => fs.statSync(dir).isDirectory)
|
||||
.map(async dir => {
|
||||
try {
|
||||
const pluginFile = path.join(dir, 'index.js');
|
||||
fs.accessSync(pluginFile);
|
||||
const plugin = validate(await import(pluginFile));
|
||||
return plugin;
|
||||
} catch (e) {
|
||||
console.error(`Error while loading plugin at [${dir}] - skipping`, e);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
);
|
||||
return plugins.filter(isNotNull);
|
||||
}
|
||||
|
||||
function findPluginDirs(workspaceFolders: string[]) {
|
||||
return workspaceFolders
|
||||
.map(root => path.join(root, '.foam', 'plugins'))
|
||||
.reduce((acc, pluginDir) => {
|
||||
try {
|
||||
const content = fs
|
||||
.readdirSync(pluginDir)
|
||||
.map(dir => path.join(pluginDir, dir));
|
||||
return [...acc, ...content.filter(c => fs.statSync(c).isDirectory())];
|
||||
} catch {
|
||||
return acc;
|
||||
}
|
||||
}, [] as string[]);
|
||||
}
|
||||
|
||||
function validate(plugin: any): FoamPlugin {
|
||||
if (!plugin.name) {
|
||||
throw new Error('Plugin must export `name` string property');
|
||||
}
|
||||
return plugin;
|
||||
}
|
||||
4
packages/foam-core/src/types.d.ts
vendored
4
packages/foam-core/src/types.d.ts
vendored
@@ -1,4 +0,0 @@
|
||||
export { Position, Point } from 'unist';
|
||||
|
||||
export type URI = string;
|
||||
export type ID = string;
|
||||
46
packages/foam-core/src/types.ts
Normal file
46
packages/foam-core/src/types.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
// this file can't simply be .d.ts because the TS compiler wouldn't copy it to the dist directory
|
||||
// see https://stackoverflow.com/questions/56018167/typescript-does-not-copy-d-ts-files-to-build
|
||||
import { Position, Point } from 'unist';
|
||||
export { Position, Point };
|
||||
|
||||
export type URI = string;
|
||||
export type ID = string;
|
||||
|
||||
export interface NoteSource {
|
||||
uri: URI;
|
||||
text: string;
|
||||
contentStart: Point;
|
||||
end: Point;
|
||||
eol: string;
|
||||
}
|
||||
|
||||
export interface WikiLink {
|
||||
type: 'wikilink';
|
||||
slug: string;
|
||||
position: Position;
|
||||
}
|
||||
|
||||
// at the moment we only model wikilink
|
||||
export type NoteLink = WikiLink;
|
||||
|
||||
export interface NoteLinkDefinition {
|
||||
label: string;
|
||||
url: string;
|
||||
title?: string;
|
||||
position?: Position;
|
||||
}
|
||||
|
||||
export interface Note {
|
||||
title: string | null;
|
||||
slug: string; // note: this slug is not necessarily unique
|
||||
properties: any;
|
||||
// sections: NoteSection[]
|
||||
tags: Set<string>;
|
||||
links: NoteLink[];
|
||||
definitions: NoteLinkDefinition[];
|
||||
source: NoteSource;
|
||||
}
|
||||
|
||||
export interface NoteParser {
|
||||
parse: (uri: string, text: string, eol: string) => Note;
|
||||
}
|
||||
25
packages/foam-core/src/utils/core.ts
Normal file
25
packages/foam-core/src/utils/core.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import crypto from 'crypto';
|
||||
|
||||
export function isNotNull<T>(value: T | null): value is T {
|
||||
return value != null;
|
||||
}
|
||||
|
||||
export function isSome<T>(value: T | null | undefined | void): value is T {
|
||||
return value != null;
|
||||
}
|
||||
|
||||
export function isNone<T>(
|
||||
value: T | null | undefined | void
|
||||
): value is null | undefined | void {
|
||||
return value == null;
|
||||
}
|
||||
|
||||
export function isNumeric(value: string): boolean {
|
||||
return /-?\d+$/.test(value);
|
||||
}
|
||||
|
||||
export const hash = (text: string) =>
|
||||
crypto
|
||||
.createHash('sha1')
|
||||
.update(text)
|
||||
.digest('hex');
|
||||
22
packages/foam-core/src/utils/hashtags.ts
Normal file
22
packages/foam-core/src/utils/hashtags.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { isSome, isNumeric } from './core';
|
||||
import matchAll from 'string.prototype.matchall';
|
||||
|
||||
const HASHTAG_REGEX = /(^|[ ])#([\w_-]+\b)/gm;
|
||||
const WORD_REGEX = /(^|[ ])([\w_-]+\b)/gm;
|
||||
|
||||
export const extractHashtags = (text: string): Set<string> => {
|
||||
return isSome(text)
|
||||
? new Set(
|
||||
Array.from(matchAll(text, HASHTAG_REGEX))
|
||||
.map(m => m[2].trim())
|
||||
.filter(tag => !isNumeric(tag))
|
||||
)
|
||||
: new Set();
|
||||
};
|
||||
|
||||
export const extractTagsFromProp = (prop: string | string[]): Set<string> => {
|
||||
const text = Array.isArray(prop) ? prop.join(' ') : prop;
|
||||
return isSome(text)
|
||||
? new Set(Array.from(matchAll(text, WORD_REGEX)).map(m => m[2].trim()))
|
||||
: new Set();
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user