Skip to content

Excessive number of DOM elements in table of contents #4063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mudge opened this issue Mar 31, 2025 · 11 comments
Open

Excessive number of DOM elements in table of contents #4063

mudge opened this issue Mar 31, 2025 · 11 comments

Comments

@mudge
Copy link
Contributor

mudge commented Mar 31, 2025

@JamesH65 flagged that the Hardware page is extremely slow in his browser even going so far as to crash it.

Looking at the structure of the page, it has over 50,000 DOM elements (for reference: Google Lighthouse will error if you have more than 1,400 elements on a page). While we'd expect a lot of elements as the Hardware section of the SDK is very long, looking at the table of contents alone reveals 12,858 elements and this appears on every single page. Digging a bit more, the table of contents seems to have 1,242 entries when fully expanded so that's the absolute minimum number of elements we would need to render it.

We can look at simplifying the markup for the table of contents but can we actually reduce the depth the table of contents goes to, e.g. to top-level sections only (e.g. "Getting started with your Raspberry Pi") rather than sub-sections (e.g. "Getting started with your Raspberry Pi - Power supply")? The theory being that would drastically cut down the size of the table of contents without also rewriting its markup.

@Wren6991
Copy link
Contributor

Wren6991 commented Mar 31, 2025

It runs fine for me on Firefox on my laptop, but really it needs to be readable on a Pi 3 etc.

I agree this doesn't need to be a single flat table of contents, and we could split the hierarchy across multiple pages to reduce the number of active DOM elements.

@JamesH65
Copy link
Contributor

Just to add that I am using Chrome on a Dell laptop, with 32GB of RAM.

@Wren6991
Copy link
Contributor

Is there a relationship between the displayed TOC depth and keys reachable from the search box?

@Wren6991 Wren6991 pinned this issue Mar 31, 2025
@Wren6991 Wren6991 unpinned this issue Mar 31, 2025
@mudge
Copy link
Contributor Author

mudge commented Mar 31, 2025

Looking at a built build/jekyll/_data/nav.json (including the Pico SDK), including only top-level titles and their sections would reduce the list to 359 entries:

  • Computers
    • Getting started
      • Getting started with your Raspberry Pi
      • Install an operating system
      • Set up your Raspberry Pi
      • Configuration on first boot
      • Next steps
    • Raspberry Pi OS
      • Introduction
      • Update software
      • Play audio and video
      • Utilities
      • Accessibility options
      • Use Python on a Raspberry Pi
      • Use GPIO from Python
    • Configuration
      • raspi-config
      • non-interactive raspi-config
      • Displays
      • Audio
      • Networking
      • Screen blanking
      • Users
      • External storage
      • Kernel command line (cmdline.txt)
      • Localise your Raspberry Pi
      • Secure your Raspberry Pi
      • Set up a headless Raspberry Pi
      • Host a wireless network from your Raspberry Pi
      • Use a proxy server
      • boot folder contents
      • LED warning flash codes
      • Configure UARTs
      • Device Trees, overlays, and parameters
      • Change the default pin configuration
    • config.txt
      • What is config.txt?
      • autoboot.txt
      • Common options
      • Onboard analogue audio (3.5mm jack)
      • HDMI audio
      • Boot Options
      • GPIO control
      • Overclocking options
      • Conditional filters
      • Memory options
      • Licence key and codec options
      • Video options
      • Camera settings
    • Legacy config.txt options
      • Legacy options
      • Legacy boot options
      • Legacy GPIO control
      • Legacy overclocking options
      • Legacy conditional filters
      • Legacy memory options
      • Legacy video options
      • Raspberry Pi 4 HDMI pipeline
      • Legacy Miscellaneous Options
    • The Linux kernel
      • Introduction
      • Update
      • Build the kernel
      • Configure the kernel
      • Patch the kernel
      • Kernel headers
      • Contribute
    • Remote access
      • Introduction to remote access
      • Find the IP address of your Raspberry Pi
      • Access a remote terminal with SSH
      • Screen share with VNC
      • Remote access with Raspberry Pi Connect
      • Share files with SCP
      • Synchronise folders between computers with rsync
      • Network File System (NFS)
      • Samba (SMB/CIFS)
      • Set up an Apache web server
      • Network boot your Raspberry Pi
      • Network boot using IPv6
    • Camera software
      • rpicam-apps
      • Stream video over a network with rpicam-apps
      • rpicam-apps options reference
      • Post-processing with rpicam-apps
      • Advanced rpicam-apps
      • Use a USB webcam
      • V4L2 drivers
      • Unicam
      • Troubleshooting
      • Getting help
    • AI Kit and AI HAT+ software
      • Getting Started
    • Raspberry Pi hardware
      • Introduction
      • Schematics and mechanical drawings
      • Product compliance and safety
      • Frequency management and thermal control
      • Raspberry Pi boot EEPROM
      • Boot diagnostics
      • Raspberry Pi boot modes
      • USB boot modes
      • USB mass storage boot
      • Network booting
      • GPIO boot mode
      • NVMe SSD boot
      • HTTP boot
      • Boot sequence
      • EEPROM boot flow
      • Raspberry Pi bootloader configuration
      • Display Parallel Interface (DPI)
      • GPIO and the 40-pin header
      • GPIO pads control
      • Industrial use of the Raspberry Pi
      • OTP register and bit definitions
      • Raspberry Pi connector for PCIe
      • Power button
      • Power supply
      • Real Time Clock (RTC)
      • Serial peripheral interface (SPI)
      • Universal Serial Bus (USB)
      • Raspberry Pi revision codes
    • Compute Module hardware
      • Compute Modules
      • IO Boards
      • CM5 Accessories
      • Flash an image to a Compute Module
      • Compute Module EEPROM bootloader
      • Wire peripherals
      • Attach a Camera Module
      • Attach the official 7-inch display
      • Specifications
    • Processors
      • BCM2835
      • BCM2836
      • BCM2837
      • BCM2837B0
      • BCM2711
      • BCM2712
      • RP3A0
  • Accessories
    • SD Cards
      • About
      • Specifications
    • SSDs
      • About
      • Specifications
    • SSD Kit
      • About
      • Install
    • M.2 HAT+
      • About
      • Features
      • Install
      • Boot from NVMe
      • Enable PCIe Gen 3
      • Schematics
      • Product brief
    • Touch Display 2
      • About
      • Specifications
      • Install
    • Monitor
      • Raspberry Pi Monitor
    • Camera
      • About the Camera Modules
      • Install a Raspberry Pi camera
      • Hardware Specification
      • Camera Filters
      • IR Filter
      • Recommended Lenses
      • Synchronous Captures
      • External Trigger on the GS Camera
    • AI Camera
      • About
      • Getting started
      • Run example applications
      • Under the hood
      • Model deployment
    • Keyboard and mouse
      • Getting Started with your Keyboard
      • Getting Started with your Mouse
      • Connecting it all Together
    • USB Hub
      • About
      • Specification
    • Build HAT
      • About
      • Prepare your Build HAT
      • Use the Build HAT from Python
      • Use the Build HAT from .NET
      • Further Resources
      • Device Compatibility
      • Mechanical Drawings
    • Sense HAT
      • About
      • Features
      • Install
      • Calibrate
      • Getting started
      • Troubleshooting
    • AI Kit
      • About
      • AI module features
      • Install
      • Get started with AI on your Raspberry Pi
      • Product brief
    • AI HAT+
      • About
      • Install
      • Get started with AI on your Raspberry Pi
      • Product brief
    • Raspberry Pi Audio
      • Overview
      • Configuration
      • Getting started
      • Hardware information
      • Updating your firmware
    • Touch Display
      • Raspberry Pi Touch Display
      • Legacy Support
    • TV HAT
      • About
      • About DVB-T
      • Install
      • Mechanical Drawing
    • Bumper
      • About
      • Assembly instructions
  • Microcontrollers
    • Silicon
      • RP2350
      • RP2040
      • RP1
      • Documentation
    • Pico-series Microcontrollers
      • Pico 2 family
      • Pico 1 family
      • Documentation
      • Software Utilities
    • Raspberry Pi Debug Probe
      • About the Debug Probe
      • Getting started
      • Install tools
      • Serial Wire Debug (SWD)
      • Serial connections
      • Updating the firmware on the Debug Probe
      • Schematics
    • MicroPython
      • What is MicroPython?
      • Drag-and-Drop MicroPython
      • Where can I find documentation?
      • Which hardware am I running on?
    • The C/C++ SDK
      • SDK Setup
      • Raspberry Pi Pico C/C++ SDK
      • Your First Binaries
      • Quick-start your own project
  • Services
    • Raspberry Pi ID
      • Create a Raspberry Pi ID
      • Enable Two-factor authentication
    • Raspberry Pi Connect (Beta)
      • Introduction
      • Install
      • Link a Raspberry Pi device with a Connect account
      • Access your Raspberry Pi device
      • Enable remote shell at all times
      • Manage devices
      • Update
      • Disconnect a device from Connect
      • Uninstall
      • Troubleshooting
  • Pico C SDK
    • Introduction
      • Raspberry Pi Pico SDK
    • Hardware APIs
      • hardware_adc RP2350
      • hardware_base RP2350
      • hardware_claim RP2350
      • hardware_clocks RP2350
      • hardware_divider RP2350
      • hardware_dcp RP2350
      • hardware_dma RP2350
      • hardware_exception RP2350
      • hardware_flash RP2350
      • hardware_gpio RP2350
      • hardware_hazard3 RP2350
      • hardware_i2c RP2350
      • hardware_interp RP2350
      • hardware_irq RP2350
      • hardware_pio RP2350
      • hardware_pll RP2350
      • hardware_powman RP2350
      • hardware_pwm RP2350
      • hardware_resets RP2350
      • hardware_riscv RP2350
      • hardware_riscv_platform_timer RP2350
      • hardware_rtc RP2040
      • hardware_rcp RP2350
      • hardware_spi RP2350
      • hardware_sha256 RP2350
      • hardware_sync RP2350
      • hardware_ticks RP2350
      • hardware_timer RP2350
      • hardware_uart RP2350
      • hardware_vreg RP2350
      • hardware_watchdog RP2350
      • hardware_xosc RP2350
    • High Level APIs
      • pico_aon_timer RP2350
      • pico_async_context RP2350
      • pico_bootsel_via_double_reset RP2350
      • pico_flash RP2350
      • pico_i2c_slave RP2350
      • pico_multicore RP2350
      • pico_rand RP2350
      • pico_sha256 RP2350
      • pico_stdlib RP2350
      • pico_sync RP2350
      • pico_time RP2350
      • pico_unique_id RP2350
      • pico_util RP2350
    • Third-party Libraries
      • tinyusb_device RP2350
      • tinyusb_host RP2350
    • Networking Libraries
      • pico_btstack RP2350
      • pico_lwip RP2350
      • pico_cyw43_driver RP2350
      • pico_cyw43_arch RP2350
    • Runtime Infrastructure
      • boot_stage2 RP2350
      • pico_atomic RP2350
      • pico_base RP2350
      • pico_binary_info RP2350
      • pico_bootrom RP2350
      • pico_bit_ops RP2350
      • pico_cxx_options RP2350
      • pico_clib_interface RP2350
      • pico_crt0 RP2350
      • pico_divider RP2350
      • pico_double RP2350
      • pico_float RP2350
      • pico_int64_ops RP2350
      • pico_malloc RP2350
      • pico_mem_ops RP2350
      • pico_platform RP2350
      • pico_printf RP2350
      • pico_runtime RP2350
      • pico_runtime_init RP2350
      • pico_stdio RP2350
      • pico_standard_binary_info RP2350
      • pico_standard_link RP2350
    • External API Headers
      • boot_picobin_headers RP2350
      • boot_picoboot_headers RP2350
      • boot_uf2_headers RP2350
      • pico_usb_reset_interface_headers RP2350

@mudge
Copy link
Contributor Author

mudge commented Mar 31, 2025

Is there a relationship between the displayed TOC depth and keys reachable from the search box?

No, what is available in search is dictated by what Algolia Docsearch crawls out of the actual page content.

@mudge
Copy link
Contributor Author

mudge commented Mar 31, 2025

It's worth noting that on sufficiently wide screens, there is a second table of contents specific to the current page shown on the right, e.g.

Image

@lurch
Copy link
Contributor

lurch commented Mar 31, 2025

From a usability PoV, I think it'd be okay to reduce the depth of the LHS navigation menu, as long as the RHS navigation menu retains its current depth. Personally, I tend to navigate the site by using the menus rather than the search box, so reducing the depth of "clickability" would make the documentation much harder to navigate IMHO.

Although I guess an alternative approach might be to have the current menu-depth only shown for the page you're currently looking at, and the ToC could then show a reduced depth for the other pages? (which I guess means that you'd need a different ToC per-page, and I dunno if that would harm cache-ability?)

@kilograham
Copy link

seems reasonable in the shortened version

@mudge
Copy link
Contributor Author

mudge commented Apr 3, 2025

Despite reducing the left-hand table of contents to 26% of its former size, @JamesH65 (and others via email) are still having issues given the Hardware page still has over 39,000 elements that need their styles recalculating as the page loads.

While I can try to further whittle down the markup in the table of contents, there are over 33,000 elements in the main page content itself.

@lurch made reference to it being a conscious past decision to format these parts of the site as a few, single, very long pages but is this something we'd revisit?

As far as I can see, postprocess_doxygen_adoc.py is actually responsible for splitting the doxygentoasciidoc output of a single all_groups.adoc into separate .adoc files. At the moment, it does this by splitting on the top-level group headings, e.g.

[#group_hardware,reftext="Hardware APIs"]

But perhaps it could be modified to break each inner group out into its own page, e.g. a page for hardware_adc and one for hardware_base, etc.

For perspective: if we did that, the current group with the largest number of elements is hardware_adc with a total of 521 elements.

@lurch
Copy link
Contributor

lurch commented Apr 3, 2025

To clarify further, I believe Paul is talking about https://www.raspberrypi.com/documentation/pico-sdk/hardware.html

@JamesH65
Copy link
Contributor

JamesH65 commented Apr 3, 2025

I have always hated (and that is not too strong a word) the move to massively long pages of information, so anything that makes them shorter is OK with me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants