Skip to content

Commit 1875626

Browse files
authored
Update Wikilinks in Markdown Files (#142)
1 parent 7485d80 commit 1875626

File tree

3 files changed

+42
-27
lines changed

3 files changed

+42
-27
lines changed

astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default defineConfig({
7070
"recipes/base-url",
7171
"recipes/root-dir",
7272
"recipes/pretty-urls",
73-
"recipes/wikilinks",
73+
"recipes/md-wikilinks",
7474
],
7575
},
7676
{
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Markdown Wikilinks
3+
---
4+
5+
## Relevant CLI Flags
6+
7+
Lychee provides a built-in `WikilinkResolver` to check Wikilinks in Markdown Files. This `WikilinkResolver` indexes all files in a given directory (incl. available subdirectories) by their filenames.
8+
Symlinks are ignored during this procedure.
9+
It then tries to resolve the extracted Wikilinks by looking up the Wikilink in the created index.
10+
11+
Both Extraction and Resolving are **deactivated by default**.
12+
13+
For checking Wikilinks please specify the following CLI Flags:
14+
15+
- `--include-wikilinks` to enable the extraction of Wikilinks
16+
- `--base-url /path/to/your/directory` where the `WikilinkResolver` should start indexing
17+
- `--fallback-extensions`, e.g. `--fallback-extensions md, mdx`
18+
19+
:::note[Good to know]
20+
Because Wikilinks do not include a file extension, lychee needs you to specify the extensions you are using with `--fallback-extensions`
21+
:::
22+
23+
Summed up the following command might be a good starting point to check for the existance of files used by Wikilinks:
24+
25+
```bash
26+
lychee --include-wikilinks \
27+
--base-url /path/to/your/local/directory \
28+
--fallback-extensions md,mdx .
29+
```
30+
31+
## Link Renaming
32+
33+
Some tools provide a possibility to rename Wikilinks by specifying the alternative title after a so-called pothole: `|`. Lets have a look at an example:
34+
35+
```Markdown
36+
[[Filename|Alternative Title]]
37+
[[Filename|Another Alternative Title]]
38+
```
39+
40+
Both Wikilinks will be displayed with their alternative titles but link to the same file.
41+
Lychee tries to resolve these Links by stripping away the alternative title and resolving by the remaining Filename only.

src/content/docs/recipes/wikilinks.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)