quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.81k stars 309 forks source link

extension navbar merging needs order #9474

Open aronatkins opened 5 months ago

aronatkins commented 5 months ago

Bug description

When a custom project type defined by an extension configures navbar entries, a project which uses that extension cannot control the order that its own navbar entries are merged.

For example, when the extension has configuration like:

contributes:
  project:
    project:
      type: website
    website:
      navbar:
        pinned: true
        right:
         - icon: "list"
           menu:
           - text: "docs.posit.co"
             href: "https://docs.posit.co"
           - text: "Posit Support"
             href: "https://support.posit.co/hc/en-us/"

A project using this extension might have additional navbar configuration like:

website:
  navbar:
    right:
      - text: "Release Notes"
        url: "https://docs.posit.co/ide/news/"

When rendered, the navbar entries from the project-type are rendered to the left of the navbar entries from the project itself.

image

Custom project types and projects should have some way of determining the final order for navbar items.

This same problem likely happens when other types of list-like configurations are merged, like page-footer entries.

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Your environment

No response

Quarto check output

No response

cscheid commented 5 months ago

Possible fix: add an explicit "sort-index" key to objects, and then have mergeConfigs understand and respect objects with such keys.