0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-09 08:45:45 +02:00

20267 Commits

Author SHA1 Message Date
hamki
0068f7cd4d
test: add test coverage for orgmode TOC header extraction
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
2026-01-26 17:27:58 +08:00
hamki
f049ed52cb
a11y: add ARIA attributes to TOC sidebar for accessibility
Add role="navigation" and aria-label to the file view sidebar panel
to improve accessibility for screen readers and assistive technologies.
2026-01-26 17:27:24 +08:00
hamki
a8a1873b27
fix: correct HTML nesting structure in TOC rendering
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>
2026-01-26 17:27:10 +08:00
hamkido
24f253fe44
Update web_src/js/features/file-view.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: hamkido <hamki.do2000@gmail.com>
2026-01-26 17:19:07 +08:00
hamkido
5896a80421
Update web_src/js/features/file-view.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: hamkido <hamki.do2000@gmail.com>
2026-01-26 17:18:37 +08:00
hamkido
860afc51d3
Update web_src/css/repo/home.css
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: hamkido <hamki.do2000@gmail.com>
2026-01-26 17:18:10 +08:00
hamkido
745aceef9b
Update web_src/js/features/file-view.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: hamkido <hamki.do2000@gmail.com>
2026-01-26 17:17:30 +08:00
hamkido
6a5ea3b2f3
Update web_src/js/features/file-view.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: hamkido <hamki.do2000@gmail.com>
2026-01-26 17:17:15 +08:00
hamkido
82a91140bf
Update templates/repo/view_file.tmpl
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: hamkido <hamki.do2000@gmail.com>
2026-01-26 17:16:36 +08:00
hamki
7a5c352d25
refactor: unify TOC rendering to use upstream TocHeadingItems for all views 2026-01-26 17:03:21 +08:00
hamki
0497d4fb89
style: update TOC button styling in README view
- 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.
2026-01-26 16:53:23 +08:00
hamkido
512d4a9383
Update modules/markup/sidebar_toc.go
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Signed-off-by: hamkido <hamki.do2000@gmail.com>
2026-01-26 16:53:23 +08:00
hamki
a9d4df6bb3
refactor: remove deprecated SidebarTocNode and clean up sidebar TOC rendering
- 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.
2026-01-26 16:52:57 +08:00
hamki
4f3d5f2968
style: enhance sidebar toggle button appearance
- 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.
2026-01-26 16:52:17 +08:00
hamki
b9ab482b75
refactor: clean up sidebar TOC structure comments
- 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.
2026-01-26 16:52:00 +08:00
hamki
01554e98cd
refactor: replace scroll event with IntersectionObserver for sidebar position updates
- 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.
2026-01-26 16:51:41 +08:00
hamki
e45bc328cc
fix: reset button default styles for btn-octicon 2026-01-26 16:51:41 +08:00
hamki
dcbad5b917
fix: remove explicit icon size for TOC button to match other btn-octicon 2026-01-26 16:51:41 +08:00
hamki
84b344ff61
fix: use btn-octicon style for TOC toggle button 2026-01-26 16:51:41 +08:00
hamki
47e11c61db
fix: lower TOC sidebar breakpoint to 768px for tablet support 2026-01-26 16:51:41 +08:00
hamki
7878f7e5ac
fix: use correct segment selector for TOC sidebar positioning 2026-01-26 16:51:40 +08:00
hamki
b3063c75da
fix: use requestAnimationFrame for smooth sidebar scroll tracking 2026-01-26 16:51:40 +08:00
hamki
37afd14208
refactor: enhance sidebar height and visibility logic
- 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.
2026-01-26 16:51:40 +08:00
hamki
ce92f7a32a
refactor: streamline sidebar positioning logic
- 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.
2026-01-26 16:51:40 +08:00
hamki
679cf25fb2
feat: introduce SidebarTocHeaders for improved sidebar TOC generation
- 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.
2026-01-26 16:51:23 +08:00
hamki
f8868e5dab
refactor: improve sidebar positioning and visibility logic
- 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.
2026-01-26 16:50:41 +08:00
hamki
111bbcd7c0
refactor: rename TOC to sidebar and update related functionality
- 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.
2026-01-26 16:50:41 +08:00
hamki
ffcb4bfda0
refactor: enhance TOC position updates with ResizeObserver and IntersectionObserver
- 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.
2026-01-26 16:50:41 +08:00
hamki
a29d0c029b
feat: add TOC sidebar for README and Markdown files 2026-01-26 16:50:40 +08:00
hamki
0506332848
fix: use CSS variable for font-weight in TOC sidebar 2026-01-26 16:50:40 +08:00
hamki
3b4f74cbf1
feat: add TOC sidebar for README and Markdown files
- 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
2026-01-26 16:50:40 +08:00
wxiaoguang
4c8f6dfa4e
Support rendering OpenAPI spec (#36449)
Fix #20852
2026-01-26 10:34:38 +08:00
Moritz Jörg
89bfddc5c2
Normalize guessed languages for code highlighting (#36450)
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>
2026-01-25 14:02:16 +00:00
silverwind
12a81d38c1
Add knip linter (#36442)
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.
2026-01-24 12:52:13 +00:00
wxiaoguang
ddc9d29713
Fix various bugs (#36446)
* Fix #36409
* Fix #36322
* Fix #30101
* Fix #36317

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-24 11:30:47 +00:00
silverwind
a608b9e1e3
Update tool dependencies (#36445)
Updates all dependencies in `Makefile`. The go fix was done
automatically, I just altered the variable name.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-24 09:58:28 +01:00
silverwind
5925433fe6
Update JS dependencies, adjust webpack config, misc fixes (#36431)
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.
2026-01-24 07:35:46 +00:00
lif
4ed43c2a32
fix: Improve image captcha contrast for dark mode (#36265)
## 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>
2026-01-24 05:41:51 +00:00
wxiaoguang
9de659437e
Refactor template render (#36438) 2026-01-24 05:11:49 +00:00
silverwind
47717d4435
Add documentation for markdown anchor post-processing (#36443)
See discussion in https://github.com/go-gitea/gitea/pull/36284.

---------

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-24 05:31:57 +01:00
Heath Dutton🕴️
0f78b99998
Fix markup heading parsing, fix emphasis parsing (#36284)
Fixes #36106, fix #17958

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-23 20:24:58 +00:00
Lunny Xiao
cfd7218395
Front port changelog for 1.25.4 (#36432)
Co-authored-by: techknowlogick <techknowlogick@gitea.com>
2026-01-23 15:31:01 +00:00
Zettat123
52c3a7d3ce
Bugfix: Potential incorrect runID in run status update (#36437)
`jobs[0]` may not belong to the run for `runID`.

Co-authored-by: Giteabot <teabot@gitea.io>
2026-01-23 11:11:56 +00:00
Kemal Zebari
56c5d5e819
Restrict branch naming when new change matches with protection rules (#36405)
Resolves #36381 by only allowing admins to perform branch renames that
match to branch protection rules.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2026-01-23 11:42:24 +01:00
wxiaoguang
e42a1dbb6b
Refactor GetRepoRawDiffForFile to avoid unnecessary pipe or goroutine (#36434) 2026-01-23 02:10:11 +00:00
silverwind
5f91c51fa5
Remove node-check and go-check, support node prerelease versions (#36382)
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>
2026-01-22 09:30:02 +01:00
wxiaoguang
3a09d7aa8d
Refactor git command stdio pipe (#36422)
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)
2026-01-22 06:04:26 +00:00
Thomas Beutlich
2a56c4ec3b
Fix spelling (#36399)
Signed-off-by: Thomas Beutlich <115483027+thbeu@users.noreply.github.com>
2026-01-22 02:52:39 +00:00
wxiaoguang
85c7901404
Fix issue filter menu layout (#36426)
Fix #36420
2026-01-22 02:22:20 +00:00
luo jiyin
6a5f9e12f9
Fix typos: unknow -> unknown, pktLineTypeUnknow -> pktLineTypeUnknown (#36419) 2026-01-22 01:17:06 +00:00