Repository: sissbruecker/linkding
Pull request #1034 (2025-04-03 19:18:15)

Bump prismjs from 1.29.0 to 1.30.0 in /docs
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.29.0 to 1.30.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/PrismJS/prism/releases">prismjs's releases</a>.</em></p>
<blockquote>
<h2>v1.30.0</h2>
<h2>What's Changed</h2>
<ul>
<li>check that <code>currentScript</code> is set by a script tag by <a href="https://github.com/lkuechler"><code>@​lkuechler</code></a> in <a href="https://redirect.github.com/PrismJS/prism/pull/3863">PrismJS/prism#3863</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/lkuechler"><code>@​lkuechler</code></a> made their first contribution in <a href="https://redirect.github.com/PrismJS/prism/pull/3863">PrismJS/prism#3863</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a href="https://github.com/PrismJS/prism/compare/v1.29.0...v1.30.0">https://github.com/PrismJS/prism/compare/v1.29.0...v1.30.0</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/PrismJS/prism/blob/master/CHANGELOG.md">prismjs's changelog</a>.</em></p>
<blockquote>
<h1>Prism Changelog</h1>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/PrismJS/prism/commit/76dde18a575831c91491895193f56081ac08b0c5"><code>76dde18</code></a> Release 1.30.0</li>
<li><a href="https://github.com/PrismJS/prism/commit/93cca40b364215210f23a9e35f085a682a2b8175"><code>93cca40</code></a> npm pkg fix</li>
<li><a href="https://github.com/PrismJS/prism/commit/99c5ca970f18f744d75e473573d4679100f87086"><code>99c5ca9</code></a> Add release script</li>
<li><a href="https://github.com/PrismJS/prism/commit/8e8b9352dac64457194dd9e51096b4772532e53d"><code>8e8b935</code></a> check that currentScript is set by a script tag (<a href="https://redirect.github.com/PrismJS/prism/issues/3863">#3863</a>)</li>
<li><a href="https://github.com/PrismJS/prism/commit/f894dc2cbb507f565a046fed844fd541f07aa191"><code>f894dc2</code></a> Fix logo in the footer</li>
<li><a href="https://github.com/PrismJS/prism/commit/ac38dcec9bea6bac064a7264b7aeba086e3102bf"><code>ac38dce</code></a> Delete CNAME</li>
<li><a href="https://github.com/PrismJS/prism/commit/9b5b09aef4dc2c18c28d2f5a6244d4efcc6ab5cb"><code>9b5b09a</code></a> Enable CORS</li>
<li>See full diff in <a href="https://github.com/PrismJS/prism/compare/v1.29.0...v1.30.0">compare view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a href="https://www.npmjs.com/~dmitrysharabin">dmitrysharabin</a>, a new releaser for prismjs since your current version.</p>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=prismjs&package-manager=npm_and_yarn&previous-version=1.29.0&new-version=1.30.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/sissbruecker/linkding/network/alerts).

</details>


Patch:
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index a8a1247..da1b3dc 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -19,6 +19,13 @@ jobs:
           username: ${{ vars.DOCKERHUB_USERNAME }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
 
+      - name: Login to GitHub Container Registry
+        uses: docker/login-action@v3
+        with:
+          registry: ghcr.io
+          username: ${{ github.actor }}
+          password: ${{ github.token }}
+
       - name: Set up QEMU
         uses: docker/setup-qemu-action@v3
 
@@ -34,6 +41,8 @@ jobs:
           tags: |
             sissbruecker/linkding:latest
             sissbruecker/linkding:${{ env.VERSION }}
+            ghcr.io/sissbruecker/linkding:latest
+            ghcr.io/sissbruecker/linkding:${{ env.VERSION }}
           target: linkding
           push: true
 
@@ -46,6 +55,8 @@ jobs:
           tags: |
             sissbruecker/linkding:latest-alpine
             sissbruecker/linkding:${{ env.VERSION }}-alpine
+            ghcr.io/sissbruecker/linkding:latest-alpine
+            ghcr.io/sissbruecker/linkding:${{ env.VERSION }}-alpine
           target: linkding
           push: true
 
@@ -58,6 +69,8 @@ jobs:
           tags: |
             sissbruecker/linkding:latest-plus
             sissbruecker/linkding:${{ env.VERSION }}-plus
+            ghcr.io/sissbruecker/linkding:latest-plus
+            ghcr.io/sissbruecker/linkding:${{ env.VERSION }}-plus
           target: linkding-plus
           push: true
 
@@ -70,5 +83,7 @@ jobs:
           tags: |
             sissbruecker/linkding:latest-plus-alpine
             sissbruecker/linkding:${{ env.VERSION }}-plus-alpine
+            ghcr.io/sissbruecker/linkding:latest-plus-alpine
+            ghcr.io/sissbruecker/linkding:${{ env.VERSION }}-plus-alpine
           target: linkding-plus
           push: true
\ No newline at end of file
diff --git a/bookmarks/services/auto_tagging.py b/bookmarks/services/auto_tagging.py
index 840745a..cdabab6 100644
--- a/bookmarks/services/auto_tagging.py
+++ b/bookmarks/services/auto_tagging.py
@@ -11,10 +11,18 @@ def get_tags(script: str, url: str):
         return result
 
     for line in script.lower().split("\n"):
-        if "#" in line:
-            i = line.index("#")
-            line = line[:i]
+        line = line.strip()
 
+        # Skip empty lines or lines that start with a comment
+        if not line or line.startswith("#"):
+            continue
+
+        # Remove trailing comment - only if # is preceded by whitespace
+        comment_match = re.search(r"\s+#", line)
+        if comment_match:
+            line = line[: comment_match.start()]
+
+        # Ignore lines that don't contain a URL and a tag
         parts = line.split()
         if len(parts) < 2:
             continue
@@ -36,6 +44,11 @@ def get_tags(script: str, url: str):
         ):
             continue
 
+        if parsed_pattern.fragment and not _fragment_matches(
+            parsed_pattern.fragment, parsed_url.fragment
+        ):
+            continue
+
         for tag in parts[1:]:
             result.add(tag)
 
@@ -65,3 +78,7 @@ def _qs_matches(expected_qs: str, actual_qs: str) -> bool:
                 return False
 
     return True
+
+
+def _fragment_matches(expected_fragment: str, actual_fragment: str) -> bool:
+    return actual_fragment.startswith(expected_fragment)
diff --git a/docs/package-lock.json b/docs/package-lock.json
index 7554093..bc54aab 100644
--- a/docs/package-lock.json
+++ b/docs/package-lock.json
@@ -5946,9 +5946,10 @@
       }
     },
     "node_modules/prismjs": {
-      "version": "1.29.0",
-      "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz",
-      "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==",
+      "version": "1.30.0",
+      "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz",
+      "integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==",
+      "license": "MIT",
       "engines": {
         "node": ">=6"
       }
diff --git a/docs/src/content/docs/auto-tagging.md b/docs/src/content/docs/auto-tagging.md
index ae8edc1..cec9cdc 100644
--- a/docs/src/content/docs/auto-tagging.md
+++ b/docs/src/content/docs/auto-tagging.md
@@ -14,8 +14,8 @@ youtube.com video
 reddit.com/r/Music music reddit
 ```
 
-When a bookmark is created or updated, the URL of the bookmark is parsed to extract the hostname, path, and query
-string. These components are then compared against the patterns defined in the auto tagging rules. If all components
+When a bookmark is created or updated, the URL of the bookmark is parsed to extract the hostname, path, query
+string and fragment. These components are then compared against the patterns defined in the auto tagging rules. If all components
 match, the tags associated with the rule are added to the bookmark. Both the bookmark form in the web interface and the
 browser extension will show a preview of the tags that will be added based on the auto tagging rules.
 
@@ -33,6 +33,9 @@ The URL matching works like this:
   rule does not specify any query string parameters, it matches all query strings. If the rule specifies a query string
   it will only match if the bookmark URL contains all the specified query string parameters with their respective
   values.
+- **Fragment Matching**: The URL fragment (part after the # symbol) is also compared when present in a rule. If the rule
+  specifies a fragment, it will match any URL whose fragment starts with the specified fragment. For example, a rule with
+  `example.com/#/projects` will match URLs like `example.com/#/projects/123` or `example.com/#/projects/456`.
 
 Note that URL matching currently does not support any kind of wildcards. Rule matching only works based on the URL, not
 on the content of the website or any other aspect of the bookmark.
diff --git a/docs/src/content/docs/community.md b/docs/src/content/docs/community.md
index 8d3a86d..7e68aa6 100644
--- a/docs/src/content/docs/community.md
+++ b/docs/src/content/docs/community.md
@@ -25,6 +25,7 @@ This section lists community projects around using linkding, in alphabetical ord
 - [Linkdy](https://github.com/JGeek00/linkdy): An open-source Android and iOS client created with Flutter. Available on the [Google Play Store](https://play.google.com/store/apps/details?id=com.jgeek00.linkdy) and [App Store](https://apps.apple.com/us/app/linkdy/id6479930976). By [JGeek00](https://github.com/JGeek00).
 - [Linklater](https://github.com/danielyrovas/linklater) An open-source Android client written in Kotlin.
 - [LinkThing](https://apps.apple.com/us/app/linkthing/id1666031776) An iOS client for linkding. By [amoscardino](https://github.com/amoscardino)
+- [linktiles](https://github.com/haondt/linktiles) A web app that displays your links as tiles in a configurable mosaic. By [haondt](https://github.com/haondt)
 - [Open all links bookmarklet](https://gist.github.com/ukcuddlyguy/336dd7339e6d35fc64a75ccfc9323c66) A browser bookmarklet to open all links on the current Linkding page in new tabs. By [ukcuddlyguy](https://github.com/ukcuddlyguy)
 - [Pinkt](https://github.com/fibelatti/pinboard-kotlin) An Android client for linkding. By [fibelatti](https://github.com/fibelatti)
 - [Postman collection](https://gist.github.com/gingerbeardman/f0b42502f3bc9344e92ce63afd4360d3) a group of saved request templates for API testing. By [gingerbeardman](https://github.com/gingerbeardman)


Test patch:
diff --git a/bookmarks/tests/test_auto_tagging.py b/bookmarks/tests/test_auto_tagging.py
index b4213a1..1273264 100644
--- a/bookmarks/tests/test_auto_tagging.py
+++ b/bookmarks/tests/test_auto_tagging.py
@@ -202,3 +202,44 @@ class AutoTaggingTestCase(TestCase):
         tags = auto_tagging.get_tags(script, url)
 
         self.assertEqual(tags, {"tag1", "tag2"})
+
+    def test_auto_tag_with_url_fragment(self):
+        script = """
+            example.com/#/section/1 section1
+            example.com/#/section/2 section2
+        """
+        url = "https://example.com/#/section/1"
+
+        tags = auto_tagging.get_tags(script, url)
+
+        self.assertEqual(tags, {"section1"})
+
+    def test_auto_tag_with_url_fragment_partial_match(self):
+        script = """
+            example.com/#/section section
+        """
+        url = "https://example.com/#/section/1"
+
+        tags = auto_tagging.get_tags(script, url)
+
+        self.assertEqual(tags, {"section"})
+
+    def test_auto_tag_with_url_fragment_ignores_case(self):
+        script = """
+            example.com/#SECTION section
+        """
+        url = "https://example.com/#section"
+
+        tags = auto_tagging.get_tags(script, url)
+
+        self.assertEqual(tags, {"section"})
+
+    def test_auto_tag_with_url_fragment_and_comment(self):
+        script = """
+            example.com/#section1 section1 #This is a comment
+        """
+        url = "https://example.com/#section1"
+
+        tags = auto_tagging.get_tags(script, url)
+
+        self.assertEqual(tags, {"section1"})