Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global linkrefs option #65

Comments

@webketje
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment