ChangeLog:. Link to issue #472

Closed
opened 2026-06-06 14:00:39 +00:00 by guettli · 3 comments
guettli commented 2026-06-06 14:00:39 +00:00 (Migrated from codeberg.org)

The ChangeLog lines often contain #123.

This should be a hyperlink to the related issue/PR.

The ChangeLog lines often contain #123. This should be a hyperlink to the related issue/PR.
guettlibot commented 2026-06-06 14:10:03 +00:00 (Migrated from codeberg.org)

Now I have everything I need. Here's the plan:


Implementation Plan

Goal: Auto-link #123 patterns in changelog lines to the corresponding Codeberg issue/PR URL.

How it works today

changelog_screen.dart loads assets/changelog.txt, optionally injects install-date markers via _injectInstallMarkers(), then passes the full string to flutter_markdown_plus's Markdown widget. The widget already handles markdown links, and the onTapLink callback already opens URLs in an external browser.

What needs to change

Only lib/ui/screens/changelog_screen.dart needs editing — one new constant and one new helper method.

Step 1 — Add a repo base URL constant

static const _repoUrl = 'https://codeberg.org/guettli/sharedinbox';

Step 2 — Add a _linkifyIssueRefs helper

static final _issueRefPattern = RegExp(r'#(\d+)');

static String _linkifyIssueRefs(String text) {
  return text.replaceAllMapped(
    _issueRefPattern,
    (m) => '[#${m[1]}]($_repoUrl/issues/${m[1]})',
  );
}

This converts #123[#123](https://codeberg.org/guettli/sharedinbox/issues/123), which flutter_markdown_plus renders as a tappable link.

Note on issues vs. PRs: Codeberg (Gitea) uses separate URL paths — /issues/123 for issues and /pulls/123 for PRs. Since the changelog text does not distinguish them, linking everything to /issues/ is simplest. If a number turns out to be a PR, the maintainer can adjust the helper or enrich the changelog format to use /pulls/ explicitly.

Step 3 — Call it in build()

In the FutureBuilder builder, apply _linkifyIssueRefs before passing content to _injectInstallMarkers (or after — order doesn't matter since they target different patterns):

final raw = snapshot.data ?? 'No changelog entries found.';
final linked = _linkifyIssueRefs(raw);
final annotated = _injectInstallMarkers(linked, versions);

Tests

Add a case to test/widget/changelog_screen_test.dart (or the relevant unit test file) that verifies _linkifyIssueRefs converts #42 to [#42](...issues/42) and that plain text without # references is returned unchanged.

Summary of files changed

File Change
lib/ui/screens/changelog_screen.dart Add _repoUrl constant, _issueRefPattern regex, _linkifyIssueRefs() helper, and call it in build()
test/widget/changelog_screen_test.dart Add unit test for _linkifyIssueRefs
Now I have everything I need. Here's the plan: --- ## Implementation Plan **Goal:** Auto-link `#123` patterns in changelog lines to the corresponding Codeberg issue/PR URL. ### How it works today `changelog_screen.dart` loads `assets/changelog.txt`, optionally injects install-date markers via `_injectInstallMarkers()`, then passes the full string to `flutter_markdown_plus`'s `Markdown` widget. The widget already handles markdown links, and the `onTapLink` callback already opens URLs in an external browser. ### What needs to change Only `lib/ui/screens/changelog_screen.dart` needs editing — one new constant and one new helper method. **Step 1 — Add a repo base URL constant** ```dart static const _repoUrl = 'https://codeberg.org/guettli/sharedinbox'; ``` **Step 2 — Add a `_linkifyIssueRefs` helper** ```dart static final _issueRefPattern = RegExp(r'#(\d+)'); static String _linkifyIssueRefs(String text) { return text.replaceAllMapped( _issueRefPattern, (m) => '[#${m[1]}]($_repoUrl/issues/${m[1]})', ); } ``` This converts `#123` → `[#123](https://codeberg.org/guettli/sharedinbox/issues/123)`, which `flutter_markdown_plus` renders as a tappable link. > **Note on issues vs. PRs:** Codeberg (Gitea) uses separate URL paths — `/issues/123` for issues and `/pulls/123` for PRs. Since the changelog text does not distinguish them, linking everything to `/issues/` is simplest. If a number turns out to be a PR, the maintainer can adjust the helper or enrich the changelog format to use `/pulls/` explicitly. **Step 3 — Call it in `build()`** In the `FutureBuilder` builder, apply `_linkifyIssueRefs` before passing content to `_injectInstallMarkers` (or after — order doesn't matter since they target different patterns): ```dart final raw = snapshot.data ?? 'No changelog entries found.'; final linked = _linkifyIssueRefs(raw); final annotated = _injectInstallMarkers(linked, versions); ``` ### Tests Add a case to `test/widget/changelog_screen_test.dart` (or the relevant unit test file) that verifies `_linkifyIssueRefs` converts `#42` to `[#42](...issues/42)` and that plain text without `#` references is returned unchanged. ### Summary of files changed | File | Change | |---|---| | `lib/ui/screens/changelog_screen.dart` | Add `_repoUrl` constant, `_issueRefPattern` regex, `_linkifyIssueRefs()` helper, and call it in `build()` | | `test/widget/changelog_screen_test.dart` | Add unit test for `_linkifyIssueRefs` |
guettlibot commented 2026-06-06 15:05:02 +00:00 (Migrated from codeberg.org)

The pull request is open at https://codeberg.org/guettli/sharedinbox/pulls/482.


Here's what I did:

Problem: #NNN references in changelog lines were plain text with no link.

Fix (lib/ui/screens/changelog_screen.dart):

  • Added a _repoUrl constant (https://codeberg.org/guettli/sharedinbox).
  • Added _linkifyIssueRefs() — a one-liner replaceAllMapped that turns #123 into [#123](https://codeberg.org/guettli/sharedinbox/issues/123).
  • Called it in build() on the raw changelog string before passing it to _injectInstallMarkers. The existing Markdown widget and onTapLink handler already handle rendering and opening the links.

Test (test/widget/changelog_screen_test.dart):

  • Added a widget test that feeds a changelog line containing #42, then asserts the #42 link text is visible in the rendered output. All 5 tests pass.
The pull request is open at **https://codeberg.org/guettli/sharedinbox/pulls/482**. --- Here's what I did: **Problem:** `#NNN` references in changelog lines were plain text with no link. **Fix** (`lib/ui/screens/changelog_screen.dart`): - Added a `_repoUrl` constant (`https://codeberg.org/guettli/sharedinbox`). - Added `_linkifyIssueRefs()` — a one-liner `replaceAllMapped` that turns `#123` into `[#123](https://codeberg.org/guettli/sharedinbox/issues/123)`. - Called it in `build()` on the raw changelog string before passing it to `_injectInstallMarkers`. The existing `Markdown` widget and `onTapLink` handler already handle rendering and opening the links. **Test** (`test/widget/changelog_screen_test.dart`): - Added a widget test that feeds a changelog line containing `#42`, then asserts the `#42` link text is visible in the rendered output. All 5 tests pass.
guettlibot commented 2026-06-06 20:40:03 +00:00 (Migrated from codeberg.org)

agentloop: agent emitted unknown loop-route "merge" (prompt merge has no such route)

agentloop: agent emitted unknown loop-route "merge" (prompt merge has no such route)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: guettli/sharedinbox#472