Skip to content

fix(mrml-core): parse quoted names in font-family values#637

Merged
jdrouet merged 2 commits into
jdrouet:mainfrom
federicobond:fix/parse-quoted-font-family
Apr 25, 2026
Merged

fix(mrml-core): parse quoted names in font-family values#637
jdrouet merged 2 commits into
jdrouet:mainfrom
federicobond:fix/parse-quoted-font-family

Conversation

@federicobond
Copy link
Copy Markdown
Contributor

@federicobond federicobond commented Apr 14, 2026

add_font_families previously only split font-family attribute values on commas, so a value like 'Source Sans 3', Helvetica, Arial was tokenised as 'Source Sans 3' (with the surrounding single quotes). The quoted token then failed lookup against the registered mj-font name="Source Sans 3" and the corresponding Google Fonts <link> was never emitted in <head>.

Replace the naive split with a small parse_font_families helper that splits and strips a single matching pair of ' or " delimiters. Embedded commas inside 'One, Two' are preserved as part of the family name.


@jdrouet the current test case felt right but let me know if you prefer a comparison test according to the contributing guidelines.

@federicobond federicobond force-pushed the fix/parse-quoted-font-family branch 2 times, most recently from 9bca834 to c2a9b10 Compare April 14, 2026 13:11
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.95%. Comparing base (5311e58) to head (d1ed0e6).
⚠️ Report is 194 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #637      +/-   ##
==========================================
+ Coverage   92.89%   92.95%   +0.06%     
==========================================
  Files         227      206      -21     
  Lines       12203    11715     -488     
==========================================
- Hits        11336    10890     -446     
+ Misses        867      825      -42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

`add_font_families` previously only split font-family attribute values
on commas, so a value like `'Source Sans 3', Helvetica, Arial` was
tokenised as `'Source Sans 3'` (with the surrounding single quotes).
The quoted token then failed lookup against the registered
`mj-font name="Source Sans 3"` and the corresponding Google Fonts
`<link>` was never emitted in `<head>`.

Replace the naive split with a small `parse_font_families` helper
that splits and strips a single matching pair of `'` or `"`
delimiters. Embedded commas inside `'One, Two'` are preserved as part
of the family name.

Signed-off-by: Federico Bond <federicobond@gmail.com>
@federicobond federicobond force-pushed the fix/parse-quoted-font-family branch from c2a9b10 to df52e69 Compare April 14, 2026 15:48
Copy link
Copy Markdown
Owner

@jdrouet jdrouet left a comment

Choose a reason for hiding this comment

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

First review from my phone, I'll have another look later.
Thanks a lot for this PR!

Comment thread packages/mrml-core/src/prelude/render/header.rs Outdated
Signed-off-by: Federico Bond <federicobond@gmail.com>
@jdrouet jdrouet merged commit c87bd8b into jdrouet:main Apr 25, 2026
20 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 25, 2026
jdrouet pushed a commit that referenced this pull request Apr 25, 2026
## 🤖 New release

* `mrml`: 6.0.0 -> 6.0.1 (✓ API compatible changes)
* `mrml-cli`: 1.7.2 -> 1.7.3
* `mrml-python`: 0.2.3 -> 0.2.4
* `mrml-wasm`: 1.6.0 -> 1.6.1

<details><summary><i><b>Changelog</b></i></summary><p>

## `mrml`

<blockquote>

##
[6.0.1](mrml-v6.0.0...mrml-v6.0.1)
- 2026-04-25

### Fixed

- clippy issue
- *(mrml-core)* parse quoted names in font-family values
([#637](#637))

### Other

- format code
</blockquote>

## `mrml-cli`

<blockquote>

##
[1.7.3](mrml-cli-v1.7.2...mrml-cli-v1.7.3)
- 2026-04-25

### Other

- update Cargo.lock dependencies
</blockquote>

## `mrml-python`

<blockquote>

##
[0.2.4](mrml-python-v0.2.3...mrml-python-v0.2.4)
- 2026-04-25

### Other

- updated the following local packages: mrml
</blockquote>

## `mrml-wasm`

<blockquote>

##
[1.6.1](mrml-wasm-v1.6.0...mrml-wasm-v1.6.1)
- 2026-04-25

### Other

- updated the following local packages: mrml
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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