machow / quartodoc

Generate API documentation with quarto
https://machow.github.io/quartodoc
MIT License
176 stars 20 forks source link

Add pandoc.meta.Meta #320

Closed has2k1 closed 8 months ago

has2k1 commented 9 months ago

Adds the ability to create a meta block from a python dictionary.

machow commented 8 months ago

Let's hold off on adding Meta, until we start using it in quartodoc. Currently, we do generate metadata for the sidebar, but it seems okay to just do the dictionary -> yaml dump directly.

I'm going to close, but will likely need to swing back and re-open later

has2k1 commented 8 months ago

That is okay, at the moment I still have it implemented in plotnine.

For the page title only, I found it necessary to generate the meta section because of how quarto creates its pages.

There is a difference in the html generated by these two snippets.

1.

---
title: Page title
---

Document content

2.

# Page Title

Document content

Quarto prefers to give the page title as in 1, though it will recognise the page title in 2.

If the title is given as metadata, it is rendered by the title-block.html template and styled with the title-block.scss stylesheet.

If in document generation you render the title as in 2, for a consistent look and feel you have to come up with css to match the visual styling done by the quarto css.

For quartodoc, the disjointedness is visible between the pages

  1. quarto page
  2. quartodoc page

It can affect the size of the columns on the page and the space above and below the page title. Same applies to py-shiny and Ibis where they mix the two different ways of doing titles. Vetiver on the otherhand does not put the title in the meta block for any quarto pages, so it is not affected.

machow commented 8 months ago

Thanks for the added context -- let me dig a bit more in the next quarto team meeting, since I know the issue of setting a title outside the yaml header is a recurring topic. Some of this might be reconciled by quarto updates (or alternatively, they might suggest we avoid setting titles via # altogether).

I definitely think it's likely we do yaml top-matter at some point, so appreciate the effort here!