Skip to content

Fix codeblock function to handle caption display - #55

Open
chuxinyuan wants to merge 1 commit into
pku-typst:mainfrom
chuxinyuan:fix-codeblock
Open

Fix codeblock function to handle caption display#55
chuxinyuan wants to merge 1 commit into
pku-typst:mainfrom
chuxinyuan:fix-codeblock

Conversation

@chuxinyuan

@chuxinyuan chuxinyuan commented Aug 1, 2026

Copy link
Copy Markdown

OS: Linux x64 7.1.5-arch1-2
Typst: 0.15.1
Description: Omitting the caption of the code block will result in an error.

Summary by CodeRabbit

  • Bug Fixes
    • Captionless code blocks now display directly without unnecessary figure wrappers, numbering, list entries, or citation references.
    • Code blocks with captions continue to support figure behavior and related references.

OS: Linux x64 7.1.5-arch1-2
Typst: 0.15.1
Description: Omitting the caption of the code block will result in an error.
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fad2da1b-7676-4c83-a79e-74f4aadb84ee

📥 Commits

Reviewing files that changed from the base of the PR and between 41d60fa and 1ad18e0.

📒 Files selected for processing (1)
  • lib/components.typ

📝 Walkthrough

Walkthrough

codeblock now renders captionless code directly. Captioned code continues to use figures with numbering, code-list metadata, and citation support.

Changes

Code block rendering

Layer / File(s) Summary
Conditional figure wrapping
lib/components.typ
codeblock returns raw content when caption is none. Captioned code retains figure wrapping and code-list metadata.

Estimated code review effort: 2 (Simple) | ~5 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies a fix to codeblock caption handling, which matches the main change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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