jbt / docker

Documentation generator
http://jbt.github.com/docker
MIT License
234 stars 56 forks source link

Links containing anchors #106

Open CodaCodr opened 8 years ago

CodaCodr commented 8 years ago

I'm coming from Docco so maybe my syntax is suspect...

I want to write

See [myFunction](somefile.js.html#myfunction)

but docker is adding ".html" to the href:

See <a href="somefile.js.html#myfunction.html">myFunction</a>

Is this a bug? Is there a workaround (short of writing out the a element longhand)?

alinex commented 8 years ago

Looks like docker is adding .html always to the end of the link (for local links). This should be easy to fix, maybe I have a look tomorrow.

CodaCodr commented 8 years ago

Agreed. That's exactly what it's doing. But I wouldn't call that "local". "relative", maybe? Either way, anchors should be preserved and not appended to.

jbt commented 8 years ago

That sounds a lot like I did something stupid and forgot that anchor links were a thing. Definitely a bug, good spot!

Should be a matter of replacing the bit that adds .html onto the end with something like .replace(/(#|$)/,'.html$1') - that way you can do [](file.js) -> file.js.html or [](file.js#anchor) -> file.js.html#anchor.

alinex commented 8 years ago

@jbt that should work if set in that line: https://github.com/jbt/docker/blob/6762a0900ed731f6b7955b226d1f53eee0fe6d41/src/docker.js#L87