Skip to content

Conversation

@ahmedasar00
Copy link

@ahmedasar00 ahmedasar00 commented Dec 17, 2025

  • Added support for Markdown tables in Entry model.
  • Added a test case (test_markdown_table_conversion) to ensure proper HTML conversion of Markdown tables.

Fixes #2314

@ahmedasar00
Copy link
Author

Hi @thibaudcolas, @sarahboyce — I’ve added support for Markdown tables in the Entry model and included a test case (test_markdown_table_conversion). The PR is ready for review. Thanks!

@ahmedasar00 ahmedasar00 changed the title 2314 Add Markdown table support and corresponding test Add Markdown table support and corresponding test Dec 17, 2025
Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

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

Image

Looks great!
Thank you for adding a test ❤️ tests make me really happy 🎊

@sarahboyce sarahboyce requested a review from a team December 18, 2025 07:30
Copy link
Member

@adamzap adamzap left a comment

Choose a reason for hiding this comment

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

This is very close!

blog/models.py Outdated
# baselevel matches `initial_header_level` from BLOG_DOCUTILS_SETTINGS
TocExtension(baselevel=3, slugify=_md_slugify),
"markdown.extensions.tables",
TableExtension(),
Copy link
Member

Choose a reason for hiding this comment

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

These two lines are doing the same thing. The first section of the documentation on extensions shows multiple ways to specify an extension:

markdown.markdown(some_text, extensions=[MyExtClass(), 'myext', 'path.to.my.ext:MyExtClass'])

So we can just pass in "tables" here since we're not customizing the extension.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks @adamzap for the clarification! Removed the duplicate tables extension and now using "tables" shorthand as no customization is needed.

blog/models.py Outdated
from django_hosts.resolvers import get_host, reverse, reverse_host
from docutils.core import publish_parts
from markdown import markdown
from markdown.extensions.tables import TableExtension
Copy link
Member

Choose a reason for hiding this comment

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

@ahmedasar00 CI is failing because you no longer need this import.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks @adamzap for pointing that out! I've removed the TableExtension import and usage because it's no longer needed—using the "tables" shorthand works fine and avoids import issues. CI should pass now.

Copy link
Member

@adamzap adamzap left a comment

Choose a reason for hiding this comment

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

👍 Looks great!

@ahmedasar00
Copy link
Author

Hi @adamzap , @sarahboyce

Thank you so much for the helpful review and guidance on this PR — I really appreciate the clarity of your feedback.

As someone who’s still learning how to contribute effectively to Django, I’d love to ask (if you don’t mind): do you have any advice or recommendations on how I can improve my future contributions, whether in code quality, tests, or choosing good issues to work on?

Your experience and work on the project are truly inspiring, and any guidance would mean a lot to me.

Thanks again, and really appreciate your time!

@sarahboyce
Copy link
Contributor

This was a good issue choice 👍
Having written a test, this already puts you in the top 20% of contributors in my opinion
If you want me to give minor nitpicks:

  • I added "Fixes [github issue link]" into the PR description for you to have this PR be linked to the issue in such a way that when this is merged, the issue gets closed
  • it is nice to add an image to your PR description when appropriate to let folks see the changes in action (and give extra confidence in your manual testing)
  • install the pre-commit or run linters manually before committing
  • squash/rebase to have a clean git history (this is my preference but I'm biased based off django/django contributions)

@adamzap
Copy link
Member

adamzap commented Dec 19, 2025

@ahmedasar00 Thank you for the kind words and also for your contribution!

In addition to what Sarah said:

  • Spend time learning the architecture, patterns, and style of the project you want to contribute to without looking for anything specific to change. The better you know the project (or part of the project) that you are contributing to, the easier it will be for you write code that fits naturally. For example, you could just study the blog app of djangoproject.com or the contrib.sessions app of django to start. This will help you to grow as a developer in general as well.
  • Try your best understand the issue and its scope before opening a pull request. Ask clarifying questions or propose an approach on the issue if there is ambiguity. We are all trying to understand open issues better.
  • Imagine yourself as the person that will review your pull request. How best can you accommodate the reviewer and make the review process pleasant? Honoring the maintainers of a project keeps things efficient and sustainable. You may find yourself as the maintainer of an open source project one day!
  • Be patient with the maintainers and know that larger or more obscure pull requests will probably take longer to get a review.

@ahmedasar00
Copy link
Author

Thank you very much, @sarahboyce and @adamzap! I really appreciate your time, support, and valuable feedback. 🙏

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.

Tables support in Markdown blog posts

3 participants