egoist / docute

📚 Effortless documentation, done right.
https://docute.egoist.dev
MIT License
3.81k stars 426 forks source link

Anchor tags don't work #118

Open niftylettuce opened 7 years ago

niftylettuce commented 7 years ago

e.g. Go to https://lassjs.github.io/lass/#/ and click on "contributors" link which should jump you down the page to the Contributors section, but instead takes you to 404. I think we should rewrite logic to autojump #foo for ?id=foo support?

egoist commented 7 years ago

hmm, it works fine for me...

niftylettuce commented 7 years ago

I mean the link "contributors" in this screenshot @egoist:

screen shot 2017-09-03 at 9 59 09 pm
egoist commented 7 years ago

oh, docute only transforms #id to ?id=id when it's written in markdown 😅 you can add a plugin to work around this:

docute.init({
  plugins: [
    replaceHref
  ]
})

function replaceHref(ctx) {
  ctx.on('content:updated', vm => {
    vm.$el.querySelector('a[href="#contributors"]').setAttribute('href', '...')
  })
}