Support Gitiles markdown rendering
Krinkle opened this issue · comments
Thanks for making jsdoc-to-markdown. I love this library and it's amazing.
At Wikimedia Foundation, we host most source code repositories with Gerrit; using Gitiles as repository viewer (from Google; used for android, chromium, etc.; googlesource.com example, wikimedia.org example).
Unfortunately, Gitiles does not support the <dl>
HTML extension to markdown. The result is that API.md (source) renders as API.md (gitiles) with much of the content missing:
Okay (md-fileserver) | Broken (Gitiles) |
---|---|
![]() |
![]() |
I'm looking to bypass this problem with a set of custom partials, but I'm not sure where to begin and how much I'd have to override. Perhaps this could be part of jsdoc2md, e.g. via a preset of some kind. Would you accept a pull request to that end?
The resulting visual rendering might be less pleasing than the indentation of dictionary lists (which I quite like actually), but it would allow for wider compatibility.
(Upstream bug report: google/gitiles#81)
Hi mate, sorry for the slow reply. You should be able achieve the output you need by passing in your own custom partials or plugin.
Start by overriding the module-index partial adding your own command-line arg value, e.g.
Next, you'll need to create the partial file module-index-krinkle.hbs
(which contains your desired index template) and pass it in with your jsdoc2md command, e.g.
$ jsdoc2md --module-index-format krinkle --partial module-index.hbs module-index-krinkle.hbs --files lib/*
For example, if using the example partials and source files here, the above command would output:
{ id: 'module:something',
longname: 'module:something',
name: 'something',
kind: 'module',
thisvalue: undefined,
meta:
{ lineno: 1,
filename: 'modulea.js',
path: '/Users/llobrook/Documents/75lb/tmp/jdsoc2md/lib' },
order: 0 }
{ id: 'module:anotherthing',
longname: 'module:anotherthing',
name: 'anotherthing',
kind: 'module',
thisvalue: undefined,
meta:
{ lineno: 1,
filename: 'moduleb.js',
path: '/Users/llobrook/Documents/75lb/tmp/jdsoc2md/lib' },
order: 1 }
CUSTOM MODULE LIST
MODULE: something
SIG-LINK:
[something](#module_something)
MODULE: anotherthing
SIG-LINK:
[anotherthing](#module_anotherthing)
CUSTOM MODULE LIST END
<a name="module_something"></a>
## something
<a name="module_anotherthing"></a>
## anotherthing
If you have any questions, you can message me using the Gitter room linked on the jsdoc2md README.
dmd-bitbucket is an example of a dmd plugin enabling support for a different markdown renderer (which i think is what you require).
closing, let me know if you have any more questions.