« get me outta code hell

generateExternalHandle.js « dependencies « content « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateExternalHandle.js
blob: 8c0368a4ac1898ae80b4e6bade726d77e59e58ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import {isExternalLinkContext} from '#external-links';

export default {
  extraDependencies: ['html', 'language'],

  data: (url) => ({url}),

  slots: {
    context: {
      validate: () => isExternalLinkContext,
      default: 'generic',
    },
  },

  generate: (data, slots, {language}) =>
    language.formatExternalLink(data.url, {
      style: 'handle',
      context: slots.context,
    }),
};