google-deepmind / torch-dokx

Scripts to help with Torch package documentation
BSD 3-Clause "New" or "Revised" License
21 stars 14 forks source link

Search does not find words in `nn` #6

Closed jucor closed 10 years ago

jucor commented 10 years ago

Hi Daniel

The search function does not seem to search through non-dokx packages, even though those packages appear on the home page of dokx-browse. Example: searching for 'neural' does not show any page from the nn package (but shows pages from other in-house packages that make use of dokx).

d11 commented 10 years ago

Hmm, do you get results from nn when you search for a function name in nn? e.g. HardTanh That works for me, so it should be including nn to some degree at least. I think it may not be indexing the standalone markdown files (e.g. README.md) which are currently what make up the bulk of the docs for some core packages such as nn. Cheers Dan

On 11 Dec 2013, at 12:16, Julien Cornebise notifications@github.com wrote:

Hi Daniel

The search function does not seem to search through non-dokx packages, even though those packages appear on the home page of dokx-browse. Example: searching for 'neural' does not show any page from the nn package (but shows pages from other in-house packages that make use of dokx).

— Reply to this email directly or view it on GitHub.

jucor commented 10 years ago

You’re correct, it finds if I search for the function name! Looks like indeed the standalone markdown (which is most of nn doc) is not indexed. Any chance to index them?

On 11 Dec 2013, at 12:22, Dan Horgan notifications@github.com wrote:

Hmm, do you get results from nn when you search for a function name in nn? e.g. HardTanh That works for me, so it should be including nn to some degree at least. I think it may not be indexing the standalone markdown files (e.g. README.md) which are currently what make up the bulk of the docs for some core packages such as nn. Cheers Dan

On 11 Dec 2013, at 12:16, Julien Cornebise notifications@github.com wrote:

Hi Daniel

The search function does not seem to search through non-dokx packages, even though those packages appear on the home page of dokx-browse. Example: searching for 'neural' does not show any page from the nn package (but shows pages from other in-house packages that make use of dokx).

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub.

d11 commented 10 years ago

My thinking there is that I should do it at the same time as extracting the headings from the standalone markdown (to add to the table of contents) - https://github.com/d11/torch-dokx/issues/4 Both that and search will require me to add anchor tags and split the standalone markdown into sections (it's less useful to index the standalone markdown if it's all just registered as one big chunk) Thanks Dan

On 11 Dec 2013, at 12:24, Julien Cornebise notifications@github.com wrote:

You’re correct, it finds if I search for the function name! Looks like indeed the standalone markdown (which is most of nn doc) is not indexed. Any chance to index them?

On 11 Dec 2013, at 12:22, Dan Horgan notifications@github.com wrote:

Hmm, do you get results from nn when you search for a function name in nn? e.g. HardTanh That works for me, so it should be including nn to some degree at least. I think it may not be indexing the standalone markdown files (e.g. README.md) which are currently what make up the bulk of the docs for some core packages such as nn. Cheers Dan

On 11 Dec 2013, at 12:16, Julien Cornebise notifications@github.com wrote:

Hi Daniel

The search function does not seem to search through non-dokx packages, even though those packages appear on the home page of dokx-browse. Example: searching for 'neural' does not show any page from the nn package (but shows pages from other in-house packages that make use of dokx).

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub.

jucor commented 10 years ago

Mmmm, I see how that can be tricky! But couldn’t thiose anchors be added automatically by sundown ? I know Redcarpet can add such anchors in a two-pass call — that’s what I used to document torch-cephes.

jucor commented 10 years ago

Answering to myself: apparently yes, it is possible to ask Sundown to add anchors to headers, by setting the option HTML_TOC. The line https://github.com/vmg/sundown/blob/master/html/html.c#L223 then takes care of adding anchors.

d11 commented 10 years ago

Hmm, I'm not sure if the lua bindings provide a way to enable that, but good find, thanks! Maybe I can coax it into doing my bidding...

On 11 Dec 2013, at 12:30, Julien Cornebise notifications@github.com wrote:

Mmmm, I see how that can be tricky! But couldn’t thiose anchors be added automatically by sundown ? I know Redcarpet can add such anchors in a two-pass call — that’s what I used to document torch-cephes. — Reply to this email directly or view it on GitHub.

d11 commented 10 years ago

Yeah, looks like I should be able to play with that via FFI. Thanks! On 11 Dec 2013, at 12:35, Daniel Horgan daniel.horgan@deepmind.com wrote:

Hmm, I'm not sure if the lua bindings provide a way to enable that, but good find, thanks! Maybe I can coax it into doing my bidding...

On 11 Dec 2013, at 12:30, Julien Cornebise notifications@github.com wrote:

Mmmm, I see how that can be tricky! But couldn’t thiose anchors be added automatically by sundown ? I know Redcarpet can add such anchors in a two-pass call — that’s what I used to document torch-cephes. — Reply to this email directly or view it on GitHub.

jucor commented 10 years ago

The problem in the lua binding is there: https://github.com/torch/sundown-ffi/blob/master/init.lua#L12

The options structure is not filled. Having its options->flags = options->flags | HTML_TOC; should fix it. For info, HTML_TOC is defined in an enum there: https://github.com/vmg/sundown/blob/master/html/html.h#L41

Julien

d11 commented 10 years ago

OK, the latest version indexes the standalone markdown, though it is still all as one section for the time being.

Although sundown does add the anchors to the HTML, I think I might do it a different way since it doesn't quite do it the way I'd like.