feat: article titles and summaries stored apart from the text (v2.16.0, ADR-076)

Articles as the IndieWeb defines them: a name separate from the content.

- Migration 023 adds notes.title and notes.summary. A one-time Python data
  step (migrations.DATA_MIGRATIONS) moves each note's '# Heading' first line
  into title, rewrites the file and hash, empties FTS for a rebuild, and puts
  files back if the migration fails. Trashed notes included.
- Micropub: name -> title, summary stored when sent with content, summary
  updatable, q=source returns both. MCP tools take a summary.
- Feeds: titles only for articles (RSS/JSON none, Atom empty); Atom and
  JSON Feed summaries; the title is no longer repeated in the content.
- Pages: p-name/p-summary on the article page. Homepage and tag pages show
  articles as title, summary and "Read more" without images (hidden u-photo
  keeps the post type for parsers).
- Crossposts: articles go out as title, summary, link and hashtags, no
  images; the Bluesky card is the article. Notes unchanged.
- Editor: Title and Summary fields; an article may have no body.
- Fix: a line starting with a hashtag ('#indieweb ...') was rendered as a
  heading and crossposted without its '#' (HashtagLineExtension).
- Fix: excerpts showed raw Markdown; they are plain text now.

Back up the database and the data folder before deploying: the migration
rewrites note files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-11 17:05:38 -07:00
1 parent 9a0d82bab2
commit 978c13358b
44 files changed
+943 -356

No files matched your search

+25 -2
View File
@@ -1,7 +1,12 @@
"""
Markdown extension: turn bare URLs into links (v2.3.0)
Markdown extensions for notes
Python-Markdown only links <https://...>; notes often contain pasted URLs.
BareUrlExtension: turn bare URLs into links (v2.3.0). Python-Markdown only
links <https://...>; notes often contain pasted URLs.
HashtagLineExtension: a line starting with a hashtag stays text (v2.16.0).
Python-Markdown makes '#indieweb is fun' a heading; CommonMark (and every
other Markdown a client may use) needs a space after the '#'.
"""
import re
@@ -9,6 +14,7 @@ import xml.etree.ElementTree as etree
from markdown.extensions import Extension
from markdown.inlinepatterns import InlineProcessor
from markdown.preprocessors import Preprocessor
from markdown.treeprocessors import Treeprocessor
from markdown.util import AtomicString
@@ -40,3 +46,20 @@ class BareUrlExtension(Extension):
# Below links (160) and <autolinks> (120), so those win
md.inlinePatterns.register(_BareUrl(BARE_URL_RE, md), "bare_url", 105)
md.treeprocessors.register(_UnnestLinks(md), "unnest_links", 0)
# Up to 3 spaces, then '#'s straight followed by text: a hashtag, not a heading
_HASHTAG_LINE_RE = re.compile(r"^( {0,3})(?=#+[^\s#])")
class _HashtagLines(Preprocessor):
"""Escape the first '#' of such a line, so it renders as text"""
def run(self, lines):
return [_HASHTAG_LINE_RE.sub(r"\1\\", line) for line in lines]
class HashtagLineExtension(Extension):
def extendMarkdown(self, md):
# After fenced code (25) and raw HTML (20) are set aside, so code is untouched
md.preprocessors.register(_HashtagLines(md), "hashtag_lines", 15)