Skip to content

Add support for adding/generating ids for sphinx-panels elements, to allow direct linking #56

@CAM-Gerlach

Description

@CAM-Gerlach

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

The Sphinx-Panels components, particularly dropdown, are very useful for constructing pages like FAQs, where linking directly to the resulting elements would be very useful. For example, we use Sphinx-Panels several places on the new docs site for the Spyder IDE, including the FAQ, where we want to be able to link users directly to specific questions.

Describe the solution you'd like

If an :id: property was added, that would allow us to either link directly to a question by id, or at least use the id to uniquely identify the element, such that we can more easily use a bit of JS to scroll to and open a specified dropdown by id. In addition, an option to to statically generate a displayed link anchor (see mockup below) to allow easy copy/pasting of the link elsewhere would be useful (though I'm not sure how you would want to style it by default; our current plan is to use a FA link icon).

Describe alternatives you've considered

For now, we're in the process of implementing by adding a unique class to each element as a "pseudo-id" and then using JS add the ids and the link anchors, but that's a crude hack that misuses HTML properties, Ultimately, in our particular application we're still going to need JS to reposition the scroll position to avoid the navbar and automatically open the linked question, but for most use cases adding an id and an anchor will be sufficient, and this will still simplify things for us considerably. Thanks.

Additional context

Example of link anchor (style, or implementation to begin with may be out of scope for sphinx-panels, but wanted to mention it just in case).

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions