nixos-search icon indicating copy to clipboard operation
nixos-search copied to clipboard

Render Markdown in option docs for flakes and longDescription

Open ncfavier opened this issue 2 years ago • 5 comments

Closes https://github.com/NixOS/nixos-search/issues/535, closes https://github.com/NixOS/nixos-search/issues/525

To do:

  • [x] We're currently creating a new temporary file containing the xref lua filter for each Pandoc invocation. This is bad. I think it would generally be nicer to package the files we need (pandoc filters, flake_info.nix) alongside flake-info: we could set a DATADIR variable in the Nix build that is detected at compile time and, if unset, defaults to CARGO_MANIFEST_DIR so that cargo run still finds the files.
  • [x] The pandoc crate does not let us define precisely the flavour of Markdown we want (Commonmark with a few extensions) because it does not expose all of Pandoc's formats and extensions (notably commonmark_x and +fenced_divs). For now I've set the format to markdown, which is hopefully a superset, but if finer control is needed we will have to ~invoke pandoc directly~ or fork the crate. At least manpage references seem to render fine. Ping @jtojnar @pennae
  • [x] There seems to be a regression with nix-security. EDIT: this is a bug exposed by making FlakeEntry tagged: we don't support multiple licenses in flake packages, so previously flake packages with a list of licenses were parsed as apps instead.

ncfavier avatar Sep 09 '22 21:09 ncfavier

🚀 Deployed on https://632899fb7bd5b614cc23836f--nixos-search.netlify.app

github-actions[bot] avatar Sep 09 '22 21:09 github-actions[bot]

Ah, markdown requires a blank line before lists whereas commonmark doesn't. That settles it, let's switch to commonmark.

ncfavier avatar Sep 10 '22 14:09 ncfavier

I've added Markdown rendering for longDescription.

As a reminder/note to self, XSS sanitisation is done by Elm.

ncfavier avatar Sep 19 '22 17:09 ncfavier

@ysndr ping

ncfavier avatar Oct 14 '22 16:10 ncfavier

(or @garbas)

ncfavier avatar Oct 18 '22 10:10 ncfavier

Looks good, and brings in some welcome cleanup Thank you @ncfavier Is there a way to see the result in the preview?

ysndr avatar Oct 28 '22 12:10 ysndr

Is there a way to see the result in the preview?

You can look at tmux or geomyidae.

ncfavier avatar Oct 28 '22 13:10 ncfavier

Ah, I shouldn't have merged so soon. The nixpkgs-unstable import is currently broken (but a fix is underway), so that channel will be rolled back a bit until the next update.

Also it seems like the flake import is hitting GitHub API rate limits. Fix: https://github.com/NixOS/nixos-search/pull/553

ncfavier avatar Oct 28 '22 14:10 ncfavier