Skip to content

Global linkrefs option #65

@webketje

Description

@webketje

The option would look like:

metalsmith.use(markdown({
  linkrefs: {
    google: 'https://google.be',
    metalsmith: 'https://metalsmith.io'
  }
})

The plugin would prepend a string of markdown with links outputted as

Object.entries(options.links)
  .map(([name, url]) => `[${name}]: ${url}`)
  .join('\n')

And this can be used to great effect to define link references in one place and use them everywhere, in documentation builds for example

*You can search on the [the google website][google]*
**You can go to the [metalsmith website][metalsmith]**

It must be prepended not appended, because file contents markdown refs take precedence over globally defined refs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions