Skip to content

User API: communicate with the library #13

Closed
@humitos

Description

@humitos

There are many integrations that will require some user configuration. For example:

  • HTML templates: there are some integrations that use HTML templates to render (e.g. flyout, non latest version warning, external version warning). We need to design a way users can tell the library what HTML template to use or giving them a way to replace ours completely (as flyout is doing via #readthedocs-embed-flyout) 1
  • Functions with logic: we are using semver to decide if the current version is the highest. However, the user may be using CalVer or a custom versioning pattern. We should allow users to tell us what's the "function that returns the highest version from a list of versions" that we should execute.
  • Element query selectors:
    • what's the selector for the main content?
    • what's the content selector to apply tooltips to the inner links?
    • what's the selector for the search-as-you-type be triggered?
    • etc
  • Data for functions:
    • default filter for search
    • extra filters for search
  • Tooltips:
    • should we apply them to all the content?
    • should we only apply them on a specific selector? (as we currently do with .hoverxref class)
    • should the doctool generate HTML tags with this specific selector?
    • should we try a defined selector and fallback to the main content if not found?

Note there may be more things to consider here, but I wanted to mentioned the ones that I found while working on this library. I'd like to define the pattern first, since once we have that defined we can easily add more. I'm looking for "the standard pattern to communicate with a js library from the browser", basically.

Also, it's worth to mention that some of them can be converted to conventions (e.g. some selectors) but we need to discuss and agree on them anyways.

Footnotes

  1. this work may require writing a policy that users should follow since they can overwrite our templates completely. We may want to "enforce" projects to show "Hosted by Read the Docs" or similar in the flyout, for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions