Add comprehensive tests for extractTocHeadingItems and collectTocHeadingItems
functions covering:
- Single level headers
- Nested/multi-level headers
- Headers with special characters
- Empty documents (no headers)
- TocShowInSection flag verification
Fix invalid HTML structure where <ul> was directly nested inside <ul>.
According to HTML specification, nested <ul> elements must be wrapped
in <li> elements.
Before: <ul><ul>...</ul></ul>
After: <ul><li><ul>...</ul></li></ul>
- Remove border from the TOC button in the README view for a cleaner appearance.
- Ensure hover state maintains no border for consistency with the overall design.
- Eliminate the deprecated SidebarTocNode from RenderContext and related functions.
- Update sidebar TOC rendering logic to exclusively use SidebarTocHeaders for improved clarity and maintainability.
- Remove fallback logic for legacy TOC rendering to streamline the codebase.
- Add border styling to the sidebar toggle button in file view to match other buttons.
- Update hover state to change border color for improved visual feedback.
- Update comments in RenderContext to clarify the deprecation of SidebarTocNode in favor of SidebarTocHeaders.
- Remove unnecessary blank line in RenderSidebarTocHTML function for improved code readability.
- Utilize IntersectionObserver to enhance performance and avoid issues associated with scroll events.
- Implement fine-grained position updates using multiple thresholds for better responsiveness during scrolling.
- Dynamically calculate the maximum height of the sidebar to prevent it from extending below the segment bottom.
- Implement logic to hide the sidebar when the available height is insufficient, improving user experience.
- Ensure the sidebar's top position does not exceed the segment's top during scrolling.
- Simplify the calculation of the sidebar's top position to ensure it aligns with the file header or sticks to the top of the viewport when necessary.
- Remove redundant opacity handling and improve clarity in the sidebar's visibility logic.
- Maintain the sidebar's position next to the content with a consistent gap.
- Add a new Header type to encapsulate header data for generating the sidebar TOC.
- Update the rendering logic to utilize SidebarTocHeaders, providing a more flexible structure for TOC generation.
- Implement extraction of headers from orgmode documents to populate SidebarTocHeaders.
- Ensure backward compatibility by maintaining the legacy SidebarTocNode for existing functionality.
- Enhance sidebar positioning to ensure it aligns with the file header and does not exceed the content's bottom.
- Implement logic to hide the sidebar when the file content is scrolled out of view.
- Replace IntersectionObserver with a scroll event listener for updating sidebar position, improving performance and responsiveness.
- Change references from TOC to sidebar in the file view and README rendering functions.
- Update CSS classes and JavaScript functions to reflect the new sidebar implementation.
- Ensure proper visibility and positioning of the sidebar in the file view context.
- Replace window resize and scroll event listeners with a ResizeObserver to monitor changes in the document body.
- Implement an IntersectionObserver for the file header to trigger TOC position updates based on its visibility.
- This improves performance and responsiveness of the TOC sidebar in file views.
- Add floating TOC panel that displays table of contents for README and markdown files
- Implement toggle button to show/hide TOC panel
- Add localStorage persistence for TOC panel visibility state
- Support both README in repo root and individual markdown file views
- Add responsive design for mobile screens
For when Enry correctly recognized the language, but returns the
language name in a way that isn't recognized by chroma.
Resolves https://github.com/go-gitea/gitea/issues/22443
---------
Co-authored-by: Moritz Jörg <moritz.jorg@oceanbox.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This adds [knip](https://github.com/webpro-nl/knip), a tool to find
unused files, dependencies and exports in JS. Fixed all discovered
issues.
1. knip apparently has some issue resolving imports from `d.ts` to `.ts`
so I worked around it by moving the two affected types to where they are
used.
2. I don't know why `modules/fomantic/dropdown.ts` had a new typescript
error, but I fixed it.
3. Use named export for `EsbuildPlugin`, I think this was added
recently.
Updates all dependencies in `Makefile`. The go fix was done
automatically, I just altered the variable name.
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1. Upgrade to [jQuery
4.0](https://blog.jquery.com/2026/01/17/jquery-4-0-0/). Two of the
removed APIs are in use by fomantic, but there are [polyfills
present](a3a3e581aa/web_src/fomantic/build/components/dropdown.js (L15-L17))
so it continues to work.
2. Remove manual naming of webpack chunks. I was running into below
webpack error and I see no reason for this manual chunk naming which is
prone to naming collisions. Also, the webpack build now shows all output
assets. This change will result in longer asset filenames, but webpack
should now be able to guarentee that the names are without collisions.
````
ERROR in SplitChunksPlugin
Cache group "defaultVendors" conflicts with existing chunk.
Both have the same name "--------" and existing chunk is not a parent of
the selected modules.
Use a different name for the cache group or make sure that the existing
chunk is a parent (e. g. via dependOn).
HINT: You can omit "name" to automatically create a name.
BREAKING CHANGE: webpack < 5 used to allow to use an entrypoint as
splitChunk. This is no longer allowed when the entrypoint is not a
parent of the selected modules.
Remove this entrypoint and add modules to cache group's 'test' instead.
If you need modules to be evaluated on startup, add them to the existing
entrypoints (make them arrays). See migration guide of more info.
3. Fix test issue related to `p > div` which is invalid as per HTML spec
because `div` is not [phrasing
content](https://html.spec.whatwg.org/multipage/dom.html#phrasing-content-2)
and therefor can not be a descendant of `p`. This is related to
https://github.com/capricorn86/happy-dom/pull/2007.
4. Add webpack globals
5. Remove obsolete docs glob
6. fix security issue for `seroval` package
7. disable [vitest isolate](https://vitest.dev/config/isolate.html) for
30% faster JS tests, which are all pure.
## Summary
This PR fixes#36255
The image captcha was using random colors which often resulted in poor
contrast against dark backgrounds, making it difficult or impossible for
users to read in dark mode.
## Changes
- Added a custom color palette to the image captcha configuration in
`services/context/captcha.go`
- The palette uses high-contrast colors (bright red, blue, green,
yellow, purple, and dark blue-gray) that provide good visibility in both
light and dark themes
- This improves accessibility and user experience without changing any
existing functionality
## Testing
- Builds successfully
- All existing tests pass
- The color palette is properly supported by the upstream
`gitea.com/go-chi/captcha` library
---
Generated with Claude Code
---------
Signed-off-by: majiayu000 <1835304752@qq.com>
Co-authored-by: silverwind <me@silverwind.io>
Resolves#36381 by only allowing admins to perform branch renames that
match to branch protection rules.
---------
Co-authored-by: Giteabot <teabot@gitea.io>
1. Remove those checks for the sake of build performance and because go
and node will fail anyways if their versions are incorrect.
3. Support pre-release Node version for determining NODE_VARS.
2. Update to the chinese READMEs to mention `pnpm` which is already
present in english README.
---------
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Most potential deadlock problems should have been fixed, and new code is
unlikely to cause new problems with the new design.
Also raise the minimum Git version required to 2.6.0 (released in 2015)