Skip to content

anakornk/gatsby-remark-enhanced-wikilink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gatsby Remark Enhanced Wikilink

A Gatsby Remark plugin to support Enhanced Wikilink Syntax (e.g., Obsidian Internal Links) for Gatsby ^4.0.0

  • To support file linking and image embedding, use with gatsby-remark-images, gatsby-remark-copy-linked-files and gatsby-source-filesystem
  • To be compatible with gatsby-remark-autolink-headers, the default implementation uses Github Slugger to slugify filenames and headings. This can be configured via setting a new wikilinkToUrl function. For more information, please see Options section below.

Supported Syntax

  • Linking to MD files via [[Internal Link#Heading | Alias]]
  • Linking to other files via [[../path/document.pdf]]
  • Embed Images ![[../images/Hello.png]]
  • Embed Notes ![[Internal Notes]]

Installation

yarn add gatsby-remark-enhanced-wikilink

Usage

Add the plugin to your Gatsby config:

// gatsby-config.js
plugins: [
    {
        resolve: "gatsby-transformer-remark",
        options: {
            plugins: [
                {
                    resolve: 'gatsby-remark-obsidian',
                    options: {
                      stripBrackets: true,
                      imageExtensions: ['png', 'jpg', 'jpeg'],
                      linkFileExtensions: ['png', 'jpg', 'jpeg', 'pdf']
                      // see other options below
                    },
                },
            ]
        }
    },
],

Options

type WikilinkArgs = {
  fileName?: string;
  heading?: string;
  alias?: string;
};

type Options = {
  stripBrackets?: boolean;
  wikilinkToUrl?: (args: WikilinkArgs) => string;
  wikilinkToLinkText?: (args: WikilinkArgs) => string;
  imageExtensions?: Array<string>;
  linkFileExtensions?: Array<string>;
};

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published