This commit is contained in:
Jason Wen
2026-03-12 22:40:58 -04:00
parent c8d543a8fe
commit b61ccf2bee
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ jobs:
# Append sync footer
gh_url = f'https://github.com/sunnypilot/sunnypilot/blob/{GITHUB_BRANCH}/docs_sp/{DOC_PATH}'
body = body.rstrip('\n') + f'\n\n---\n<small>This document is version-controlled. Suggest changes [on GitHub]({gh_url}).</small>\n\n<!-- docs-sync-id: {DOC_PATH} -->\n'
body = body.rstrip('\n') + f'\n\n---\n<small>This document is version-controlled. Suggest changes [on GitHub]({gh_url}).</small>\n<small>docs-sync-id: {DOC_PATH}</small>\n'
# Extract title from front matter or first heading
title = None
+5 -3
View File
@@ -98,9 +98,11 @@ class DiscourseClient:
# ----- Public API -----
def find_topic_by_sync_id(self, sync_id: str) -> dict[str, Any] | None:
"""Find an existing topic by its embedded sync ID comment.
"""Find an existing topic by its embedded sync ID marker.
Searches for topics containing <!-- docs-sync-id: {sync_id} -->.
Searches for topics containing the visible sync ID text
``docs-sync-id: {sync_id}``. The marker must be visible (not an
HTML comment) so that Discourse indexes it.
Args:
sync_id: The doc path used as sync identifier.
@@ -108,7 +110,7 @@ class DiscourseClient:
Returns:
Topic dict with at least 'id' key, or None if not found.
"""
query = f"<!-- docs-sync-id: {sync_id} -->"
query = f'"docs-sync-id: {sync_id}"'
encoded = urllib.parse.urlencode({"q": query})
data = self._get(f"/search.json?{encoded}")
if data is None: