Skip to content

Comments

feature/agentsmd translate jp2en#22

Merged
dendencat merged 2 commits intomainfrom
feature/agentsmd-translate-jp2en
Sep 16, 2025
Merged

feature/agentsmd translate jp2en#22
dendencat merged 2 commits intomainfrom
feature/agentsmd-translate-jp2en

Conversation

@dendencat
Copy link
Owner

  • feat: enhance article editing with unique slug generation and improved UI for editing and publishing
  • AGENTS.mdを日本語から英語に更新

@dendencat dendencat merged commit e613775 into main Sep 16, 2025
1 check passed
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Comment on lines 16 to 23
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={

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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 👍 / 👎.

Comment on lines +55 to +59
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}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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 👍 / 👎.

@dendencat
Copy link
Owner Author

@codex fix comments.

@chatgpt-codex-connector
Copy link

Summary

  • Trimmed generated article slugs so the base portion is truncated before appending the UUID fragment, ensuring the final slug always fits the configured field length and still avoids collisions. techblog_cms/models.pyL55-L77
  • Pointed the Markdown filter to Django’s built-in markdown.extensions.linkify extension so linkification works without requiring an unavailable third-party module. techblog_cms/templatetags/markdown_filter.pyL1-L32

Testing

  • ⚠️ pytest (fails: ValueError configuring log handler because /workspace/techblog_cms/logs/django.log is missing)

View task →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant