Skip to content

Merge dev branch into main - #141

Open
Dherse wants to merge 50 commits into
mainfrom
dev-v1.4.0
Open

Dherse wants to merge 50 commits into
mainfrom
dev-v1.4.0

Conversation

@Dherse

@Dherse Dherse commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Near complete rewrite of codly:

  • performance improvements: a mix of algorithmic improvements, smarter memoization boundary data propagation
  • memory improvement: mostly through less boundary propagation and less allocations of temporary arrays
  • now using elembic for show/set rule behaviour
  • Implemented many feature request (final list TBD) and many requested fixed (final list TBD)

Disclosure: AI was used in the making of this code, mostly around building/improving the tests & to help me do roadmap of issue fixing/tracking, there were so many at this point I was struggling to keep up. Almost none of the actual library code is AI generated.

Dherse added 16 commits August 28, 2026 17:39
Implement #102 and adapt changes from PRs #103, #123, and #132.
Add regression coverage for #94, #106, #110, #118, #129, #135,
and behavior covered by PRs #115 and #119.
- Size annotations from displayed rows, including wrapping, ranges, and skips.
- Round outside fills and strokes using one source grid, supporting pagination, columns, and nested blocks.
- Reserve border space within layout bounds.
- Preserve alias text sizing and inherited theme/syntax paths; require resolved paths or bytes for explicit resource arguments.
- Preserve native references while keeping code and annotation text  accessible in PDF output.
- Add compact regressions, refresh visual baselines, and add PDF/UA-1 compilation and text extraction checks to CI.

Fixes #140
Fixes #139
Fixes #134
Fixes #107
Fixes #95
Fixes #99
Fixes #113
@Dherse Dherse mentioned this pull request Sep 20, 2026
Also fix tests to match new default behaviour (auto fill).
@Dherse Dherse mentioned this pull request Sep 22, 2026
@MBradbury

Copy link
Copy Markdown

Would it be possible to add the number-format option back in, I think it would be sufficient to do the following for the codly-number arguments:

Add a field for format:

e.field("format", e.types.option(function), doc: __doc("number-format"), default: __default("number-format")),

Call format on the body:

display: it => (it.format)(it.body),

In 1.3.0, I have used this to style the line numbers and also add a link to the line number (e.g., to a website that explains a bash command).

For example, I would do:

#import "@preview/percencode:0.1.0": percent-encode
#let number-format(number) = {
    let rawblock = query(selector(raw).before(here())).last()
    let number-text = text(size: 10pt, fill: dark-grey)[#number]
    if rawblock.lang == "bash" {
        let line-text = rawblock.lines.at(number - 1).text
        link("https://explainshell.com/explain?cmd=" + percent-encode(line-text), number-text)
    } else {
        number-text
    }
}
#show: codly.number-set_(
    format: number-format,
)

@Dherse

Dherse commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner Author

@MBradbury You're right, but I'll do it a bit differently, I'll give codly-number more capabilities, namely taking in a numbering (function or auto or str) and having a line arg. I think this is just an oversight of rewriting the code. I will fix it tonight! Thanks a ton of taking the time to try it out and find the issues!!!

EDIT: this is in fact how I originally intended for it to work, but as I was prototyping I probably forgot 🙈

@MBradbury

MBradbury commented Sep 23, 2026 •

Copy link
Copy Markdown

Thanks for taking a look! The accessibility fixes will be nice, as Codly was my blocker for PDF/UA-1.

I think the only other regression I spotted was that language tags now render on top of any code, which is a problem if there is a very long first line of code. I believe in 1.3.0 the language tags would "push" the long line of code onto another line. I have not tried your recent changes, so not sure if it got fixed as part of them.

For example, in the following the -o is covered by the Bash language tag, whereas I think the -o would have been pushed onto the line with rshell-syscall.o in 1.3.0.

image
\```bash
gcc -fPIC -fcf-protection=none -nolibc -nostdlib -c rshell-syscall.c -o 
rshell-syscall.o
\```

@Dherse

Dherse commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

Ah yes, the old code was "smart" in that regard, I'll fix that too. Thanks! Don't hesitate if you find anythign else.

@Dherse Dherse mentioned this pull request Sep 27, 2026
@MBradbury

Copy link
Copy Markdown

Just tested the latest commit and I was able to adapt my code in #141 (comment) to work with the changes, thanks very much!

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.

2 participants