arliss_obsidian/fp/Scripts/pursuit_link.js
2024-09-22 14:24:51 -05:00

13 lines
454 B
JavaScript

module.exports = async (path) => {
path = await path
pkg = path.split('/')[0]
mod = path.split('/')[1]
let dots = path.split('.')
let mod = dots.filter(s => s[0].toUpperCase() === s[0]).join('.')
let last = dots[dots.length - 1]
let val = last[0].toLowerCase() === last[0] ? last : ''
val = val ? `#v:${val}` : ''
const url = `https://pursuit.purescript.org/packages/purescript-${pkg}/docs/${mod}${val}`
return `[${path}](${url})`
}