Conversation
dendencat
commented
Sep 16, 2025
- feat: enhance article editing with unique slug generation and improved UI for editing and publishing
- AGENTS.mdを日本語から英語に更新
…d UI for editing and publishing
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| html = markdown.markdown(text, extensions=[ | ||
| 'extra', # Extra features like tables, footnotes, and raw HTML | ||
| 'codehilite', # Code highlighting with Pygments | ||
| 'toc', # Table of contents | ||
| 'toc', # Table of contents | ||
| 'fenced_code', # Fenced code blocks | ||
| 'nl2br', # Convert newlines to <br> | ||
| 'nl2br', # Convert newlines to <br> | ||
| 'linkify', # Auto-link plain URLs | ||
| ], extension_configs={ |
There was a problem hiding this comment.
[P0] Ensure linkify extension is installed or referenced correctly
Adding 'linkify' to the Markdown extensions list causes markdown.markdown() to import a module literally named linkify, but the repo only adds linkify-it-py, which does not provide that module. Calling markdown_to_html now raises ModuleNotFoundError: No module named 'linkify', breaking article rendering and the markdown preview. Use the fully qualified 'markdown.extensions.linkify' (and keep linkify-it-py as the optional dependency) or install the third‑party mdx_linkify package so the extension can be imported.
Useful? React with 👍 / 👎.
| def _generate_unique_slug(self): | ||
| base_slug = slugify(self.title) or 'article' | ||
| while True: | ||
| hash_fragment = uuid.uuid4().hex[:8] | ||
| candidate = f"{base_slug}-{hash_fragment}" |
There was a problem hiding this comment.
[P1] Truncate base slug before appending UUID fragment
The new _generate_unique_slug always appends a hyphen plus an 8‑character UUID fragment to the slugified title. Because the slug field uses Django’s default SlugField(max_length=50), any title whose slugified form exceeds 41 characters now produces a slug longer than the column and will fail to save with a database error. Previously only colliding slugs grew past 50, so many long but valid titles are now rejected. Consider limiting base_slug to 41 characters before appending the suffix or increasing the field’s max_length.
Useful? React with 👍 / 👎.
|
@codex fix comments. |
|
Summary
Testing
|