An open API service indexing awesome lists of open source software.

https://github.com/flowershow/remark-wiki-link-plus

Parse and render wiki-style links in markdown especially Obsidian style links.
https://github.com/flowershow/remark-wiki-link-plus

remark-plugin

Last synced: over 1 year ago
JSON representation

Parse and render wiki-style links in markdown especially Obsidian style links.

Awesome Lists containing this project

README

          

🛑 This repository has been merged into [Flowershow monorepo](https://github.com/flowershow/flowershow).

# remark-wiki-link-plus

Parse and render wiki-style links in markdown especially Obsidian style links.

## What is this ?

Using obsidian, when we type in wiki link syntax for eg. `[[wiki_link]]` it would parse them as anchors.

## Features supported

- [x] Support `[[Internal link]]`
- [x] Support `[[Internal link|With custom text]]`
- [x] Support `[[Internal link#heading]]`
- [x] Support `[[Internal link#heading|With custom text]]`
- [x] Support `![[Document.pdf]]`
- [x] Support `![[Image.png]]`
* Supported image formats are jpg, jpeg, png, apng, webp, gif, svg, bmp, ico
* Unsupported image formats display a message for eg. `![[Image.xyz]]` would render the following:
`Document type XYZ is not yet supported for transclusions`

Future support:
- [ ] Support `![[Audio.mp3]]`
- [ ] Support `![[Video.mp4]]`
- [ ] Support `![[Embed note]]`
- [ ] Support `![[Embed note#heading]]`

## Installation

```bash
npm install remark-wiki-link-plus
```

## Usage

```javascript
const unified = require('unified')
const markdown = require('remark-parse')
const wikiLinkPlugin = require('remark-wiki-link-plus');

let processor = unified()
.use(markdown, { gfm: true })
.use(wikiLinkPlugin)
```

### Configuration options

* `options.markdownFolder [String]`: A string that points to the content folder.

The default `hrefTemplate` is:

```javascript
(permalink) => `/${permalink}`
```

## Running the tests

```bash
npm run test
```

# Change Log

## [1.1.1] - 2022-11-14

### Fixed

- Permalinks not linking to case sensitive url paths
- eg. before `[[Page]]` generates `href="/page"` but will now generate `href="/Page"`

## [1.1.0] - 2022-09-06

### Added

- Add support for more image formats
- apng, webp, gif, svg, bmp, ico
- Add support for PDF documents
- Add warning for unsupported image formats

## [1.0.2] - 2022-08-11

### Added

- Add support for transclusion links / image links
- png, jpg, jpeg

## [1.0.1] - 2022-08-04

### Changed

- permalink for folders with an index file will tranform to folder name only.
For example, if the wikilink is [[docs/index]] the href will be '/docs'.

### Fixed

- broken links to filenames that matched the markdown folder name.