Skip to content

check_formalities: escape LaTeX special characters in output#13

Merged
GeorgeSapkin merged 1 commit intoGeorgeSapkin:mainfrom
BKPepe:fix/latex-escaping
Jan 14, 2026
Merged

check_formalities: escape LaTeX special characters in output#13
GeorgeSapkin merged 1 commit intoGeorgeSapkin:mainfrom
BKPepe:fix/latex-escaping

Conversation

@BKPepe
Copy link
Copy Markdown
Contributor

@BKPepe BKPepe commented Jan 11, 2026

The script currently inserts substrings of the commit subject and body directly into LaTeX-formatted strings for GitHub Actions output. If these substrings contain special LaTeX characters (such as underscore '_'), it causes the LaTeX rendering to fail in the CI output.

This commit introduces a helper function 'escape_latex' in 'src/helpers.sh'
which escapes common LaTeX special characters
('', '_', '$', '&', '%', '#', '{', '}').

The 'check_formalities.sh' script is updated to use this function when preparing the failure output, ensuring that the generated LaTeX is valid regardless of the commit content.

Fixes: #12 (comment)

Copilot AI review requested due to automatic review settings January 11, 2026 18:17
@github-actions

This comment has been minimized.

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

This PR fixes LaTeX rendering failures in GitHub Actions output by escaping special characters in commit messages. The issue occurred when commit subjects or bodies contained LaTeX special characters (like underscores), causing the CI output rendering to fail.

Changes:

  • Added escape_latex helper function to escape common LaTeX special characters
  • Updated output_split_fail and output_split_fail_ex functions to apply escaping before generating LaTeX output

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/helpers.sh Introduces new escape_latex function to escape LaTeX special characters (backslash, underscore, dollar, ampersand, percent, hash, braces)
src/check_formalities.sh Updates output functions to escape commit text before inserting into LaTeX-formatted GitHub Actions output

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

@BKPepe
Copy link
Copy Markdown
Contributor Author

BKPepe commented Jan 12, 2026

Always fun with Copilot.

@BKPepe BKPepe force-pushed the fix/latex-escaping branch from 0e1b202 to bb5e6ed Compare January 12, 2026 08:40
@github-actions

This comment has been minimized.

@BKPepe BKPepe force-pushed the fix/latex-escaping branch from bb5e6ed to f87922b Compare January 12, 2026 08:48
@github-actions

This comment has been minimized.

@BKPepe BKPepe force-pushed the fix/latex-escaping branch from f87922b to c04d209 Compare January 12, 2026 09:36
@github-actions

This comment has been minimized.

@BKPepe BKPepe force-pushed the fix/latex-escaping branch from c04d209 to 4fa40bb Compare January 12, 2026 10:12
@github-actions

This comment has been minimized.

@BKPepe BKPepe force-pushed the fix/latex-escaping branch from 4fa40bb to 0b61f24 Compare January 12, 2026 10:24
@github-actions

This comment has been minimized.

@BKPepe BKPepe force-pushed the fix/latex-escaping branch from 0b61f24 to d68955d Compare January 12, 2026 10:24
@github-actions

This comment has been minimized.

The script currently inserts substrings of the commit subject and body
directly into LaTeX-formatted strings for GitHub Actions output. If
these substrings contain special LaTeX characters (such as underscore
'_'), it causes the LaTeX rendering to fail in the CI output.

This commit introduces a helper function 'escape_latex' in
'src/helpers.sh' which escapes common LaTeX special characters ('\',
'_', '$', '&', '%', '#', '{', '}').

The 'check_formalities.sh' script is updated to use this function when
preparing the failure output, ensuring that the generated LaTeX is valid
regardless of the commit content.

Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
@GeorgeSapkin GeorgeSapkin merged commit 2d1b2b1 into GeorgeSapkin:main Jan 14, 2026
2 checks passed
@GeorgeSapkin
Copy link
Copy Markdown
Owner

After enabling comments in luci, looks like LaTeX coloring and escaping is borked (I left the broken ones only):

From:

Commit 987137f4fdd4c3343df9f251b2b08b313ed23a85

Commit 5e524e8e0fa21b28968462a87f40370b512adc39

  • 🔶 Commit message lines should be <= 75 characters long
    Actual: line 2 is 83 characters long
    $\textsf{Fix incorrect @Lends, @name, @Class, and @classdesc annotations to match th\color{red}{e actual}}$

Commit 78a62f261bb956b3246eb8b7a1c85b794d9229a2

  • 🔶 Commit subject must be <= 80 (and should be <= 60) characters long
    Actual: subject is 77 characters long
    $\textsf{luci-app-acme: fixed the issue where certificates were not d\color{yellow}{isplaying (#8151)}\color{red}{}}$

Commit 21eeb6e9f76f9b074c3ec9a3be3577bd508613f4

  • 🔶 Commit message lines should be <= 75 characters long
    Actual: line 2 is 87 characters long
    $\textsf{Changes DHCPv6 statistics display to tooltips in IPv6 Upstream network inte\color{red}{rface boxes.}}$

Commit 2106f0952f5c0cc0a307b9146e6ffd28505e06e7

  • ❌ Commit subject must be <= 80 (and should be <= 60) characters long
    Actual: subject is 103 characters long
    $\textsf{luci-base: add responseProgress callback and stderr opti\color{yellow}{on for LuCI.request }\color{red}{and fs.exec\_direct().}}$

I'm thinking if it even makes sense fixing it at this point.

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