marzer / poxy

Documentation generator for C++
https://pypi.org/project/poxy
MIT License
135 stars 5 forks source link

Injection of search data #23

Open tim-janik opened 1 year ago

tim-janik commented 1 year ago

Is your feature request related to a problem? Please describe.

I would like to have a way to inject a list of [ (keyword,link), ... ] pairs into the search_data.

The Anklang project now uses Poxy to generate its C++ and JS API reference documentation. Since C++ is supported directly by Poxy + Doxygen, search works here, but the JS docs are provided as generated html snippets (using JsDoc + pandoc under the hood) and included via @file f.js \n @htmlinclude[block] f.js.html. You can take a peek here: https://tim-janik.github.io/docs/anklang/files.html

Due to the @htmlinclude, the JS symbols are not searchable. Generating a list of interesting symbol names and anchors is doable with some effort, e.g.:

symbols = [ ( 'vue_mixins', 'https://tim-janik.github.io/docs/anklang/util_8js.html#vue_mixins-class' ), ]

But then i still need a way to inject those into the poxy or m.css search_data list.

Describe the solution you'd like

Ideally, I could configure poxy.toml to include a searchdata.json (or searchdata.py) list of symbols+links into searchdata-v2.js.

Additional context

I can start base85 decoding searchdata-v2.js to inject the search list myself, but I figured I'd ask before going through that effort. ;-)

BTW, another use case for injecting search data could be to add tokens from content included via the Doxygen \page command, but making the JS docs searchable is most pressing for me atm.

marzer commented 1 year ago

This is a great idea, but I should probably point out that all the search implementation is 100% m.css; poxy is mostly XML fixes and Doxygen post-processes. Consider suggesting this on the m.css repo?

I could reverse engineer the search implementation, but in general I'd like to keep a decent amount of parity with m.css, and contribute features (or ideas) there wherever possible.

I don't mind implementing entirely new things (e.g. dark/light theme switching), but always the intent in those situations is to contribute back to m.css in some fashion.

cc @mosra