Skip to content

Add grouped subsections#694

Open
faridrashidi wants to merge 16 commits into
rendercv:mainfrom
faridrashidi:subsection-for-publication
Open

Add grouped subsections#694
faridrashidi wants to merge 16 commits into
rendercv:mainfrom
faridrashidi:subsection-for-publication

Conversation

@faridrashidi
Copy link
Copy Markdown

@faridrashidi faridrashidi commented Mar 13, 2026

Summary

Following #545, this adds first-class support for grouped subsections inside a single PublicationEntry section.

Users can now keep one top-level Publications heading while grouping entries under subsection labels such as Journal Articles, Conference Proceedings, or Pre-prints:

cv:
  sections:
    publications:
      journal_articles:
        - title: ...
          authors: [...]
      conference_proceedings:
        - title: ...
          authors: [...]

This is scoped to publications only. Existing flat publication lists continue to work unchanged.

Changes

  • Extend section validation to accept either:

    • the existing flat homogeneous list
    • a grouped publication mapping of subsection_title -> list[PublicationEntry]
  • Keep grouped subsection support limited to PublicationEntry

  • Normalize grouped publication sections into render sections with:

    • entry_type = "PublicationEntry"
    • flattened entries
    • ordered subsections
  • Reuse section title formatting for subsection titles

  • Process subsection titles in the model processor

  • Render subsection headings in Markdown and Typst without changing publication entry layout

  • Skip empty grouped subsections during rendering

  • Add configurable subsection title spacing through:

    design:
      subsection_titles:
        space_above: 0cm
        space_below: 0cm
  • Update user documentation and regenerate schema.json

Testing

Added test coverage for:

  • grouped publication section validation
  • preserving existing flat publication section behavior
  • rejecting grouped non-publication sections
  • nested validation error locations for grouped publication input
  • subsection title processing in the model processor
  • subsection title spacing in Typst output
  • Markdown/Typst/HTML grouped-publication rendering output

Verification

uv run pytest tests/schema/models/cv/test_section.py tests/schema/models/cv/test_cv.py tests/schema/test_pydantic_error_handling.py tests/schema/models/design/test_classic_theme.py tests/schema/test_json_schema_generator.py tests/renderer/templater/test_model_processor.py tests/renderer/test_markdown.py tests/renderer/test_typst.py tests/renderer/test_html.py -q
uv run prek run ruff-check ruff-format ty-check --all-files

Copilot AI review requested due to automatic review settings March 13, 2026 14:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class support for grouped publication subsections (e.g., “Journal Articles”, “Conference Proceedings”) in CV sections, ensuring they validate correctly, render with subsection headings, and produce accurate nested validation error locations.

Changes:

  • Extend the CV section schema to accept either a flat list of entries or a grouped mapping for PublicationEntry subsections, and expose subsections in the renderable section model.
  • Update the templater/model pre-processing to render subsection headings and ensure subsection titles are processed consistently.
  • Add test coverage + golden reference outputs for grouped-publications rendering across Typst/Markdown/HTML, plus docs/schema updates.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/schema/test_pydantic_error_handling.py Adds coverage for nested schema locations when grouped publication entries fail validation.
tests/schema/models/cv/test_section.py Adds validation tests for grouped publication subsections and rejection for non-publication grouped entries.
tests/schema/models/cv/test_cv.py Adds CV-level test ensuring grouped publication sections create subsections as expected.
tests/renderer/testdata/test_typst/sb2nov_grouped_publications.typ Golden Typst output for grouped publications (sb2nov theme).
tests/renderer/testdata/test_typst/moderncv_grouped_publications.typ Golden Typst output for grouped publications (moderncv theme).
tests/renderer/testdata/test_typst/engineeringresumes_grouped_publications.typ Golden Typst output for grouped publications (engineeringresumes theme).
tests/renderer/testdata/test_typst/engineeringclassic_grouped_publications.typ Golden Typst output for grouped publications (engineeringclassic theme).
tests/renderer/testdata/test_typst/classic_grouped_publications.typ Golden Typst output for grouped publications (classic theme).
tests/renderer/testdata/test_markdown/grouped_publications.md Golden Markdown output for grouped publications.
tests/renderer/testdata/test_html/grouped_publications.html Golden HTML output for grouped publications.
tests/renderer/test_typst.py Adds Typst renderer test for grouped publications across all themes.
tests/renderer/test_markdown.py Adds Markdown renderer test for grouped publications.
tests/renderer/test_html.py Adds HTML renderer test for grouped publications.
tests/renderer/templater/test_model_processor.py Ensures string processing (e.g., bold keywords) applies to subsection titles and entries.
tests/renderer/conftest.py Adds a fixture producing a grouped-publications RenderCVModel used by renderer tests.
src/rendercv/schema/models/cv/section.py Implements grouped publication section support, including subsection modeling and validation.
src/rendercv/schema/models/cv/cv.py Updates sections field description/examples to document grouped publication mappings.
src/rendercv/renderer/templater/templates/typst/SubsectionHeading.j2.typ Introduces Typst subsection heading template.
src/rendercv/renderer/templater/templates/markdown/SubsectionHeading.j2.md Introduces Markdown subsection heading template.
src/rendercv/renderer/templater/templater.py Renders grouped sections with subsection headings and per-subsection entries.
src/rendercv/renderer/templater/model_processor.py Applies string processors to subsection titles during model preprocessing.
schema.json Updates generated schema to include GroupedPublicationEntries and updated Section union.
docs/user_guide/yaml_input_structure/cv.md Documents YAML structure for grouped publication subsections.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tests/schema/test_pydantic_error_handling.py Outdated
@sinaatalay
Copy link
Copy Markdown
Member

Thanks a lot for your work. This is an interesting feature, but I think the right architecture for this would be creating a new entry type which accepts section titles and a list of entries below those section titles, just like the cv.sections field, but as a new entry type. What do you think?

Entry name would be: SubsectionEntry.

Something like this:

cv:
  sections:
    publications:
      - title: Subsection Heading
        entries:
         - A text entry.
      - title: Another subsection
        entries:
         - name: A normal entry.

@faridrashidi faridrashidi changed the title Add grouped subsections for publication sections Add grouped subsections Mar 20, 2026
@faridrashidi
Copy link
Copy Markdown
Author

faridrashidi commented Mar 21, 2026

Thanks @sinaatalay, I agree with this direction. I updated the implementation to use a first-class SubsectionEntry shape for all sections instead of supporting subsections only for publications.

The new behavior is:

  • a section can be either a flat list of entries, or
  • a list of subsection entries
  • each subsection has a title and entries
  • each subsection infers its own inner entry type independently

So the structure now looks like this:

cv:
  sections:
    selected_work:
      - title: Papers
        entries:
          - title: Example Paper
            authors:
              - Jane Doe
            date: 2024
            journal: Journal of Examples

      - title: Projects
        entries:
          - name: Example Tool
            summary: A small project entry.

      - title: Summary
        entries:
          - Built support for subsection-based sections.

or another example:

cv:
  sections:
    publications:
      - title: Co-First Author
        entries:
          - title: Example Journal Paper
            authors:
              - Jane Doe
              - John Smith
            date: 2024
            journal: Genome Research

      - title: Conferences
        entries:
          - title: Example Conference Paper
            authors:
              - Jane Doe
            date: 2023
            journal: RECOMB

      - title: Preprints
        entries:
          - title: Example Preprint
            authors:
              - Jane Doe
            date: 2025
            journal: bioRxiv

This keeps subsection nesting to one level, and a section still has to choose one top-level shape: either flat entries or subsection entries, but not both mixed together.

@sinaatalay
Copy link
Copy Markdown
Member

Thank you. I'll review and merge this before v2.9 release.

@faridrashidi
Copy link
Copy Markdown
Author

Hi @sinaatalay, are you planning to merge this PR?

@sinaatalay
Copy link
Copy Markdown
Member

Hi @faridrashidi, sorry for the delay. I'm not able to work on the RenderCV package at the moment, but I'll merge this before v2.9.

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.

3 participants