Skip to content

fix(compare): improve paragraph equality logic / reduce testdata(markdown pages)#243

Merged
k1LoW merged 2 commits intomainfrom
reduce-testdata
Jul 13, 2025
Merged

fix(compare): improve paragraph equality logic / reduce testdata(markdown pages)#243
k1LoW merged 2 commits intomainfrom
reduce-testdata

Conversation

@k1LoW
Copy link
Owner

@k1LoW k1LoW commented Jul 13, 2025

This pull request introduces changes to improve the comparison logic in compare.go and updates multiple Markdown test data files to include a new layout metadata. The key updates include refining the equality check for paragraphs and fragments, adding a new import dependency, and appending metadata to test files for layout consistency.

Updates to compare.go:

  • Enhanced paragraph comparison logic:
    • Replaced JSON marshaling with direct comparison of merged fragments, ensuring attributes like Bold, Italic, Link, and Code are checked individually. SoftLineBreak and ClassName are excluded from the comparison.
  • Added strings package import:
    • Included the strings package to facilitate trimming operations during fragment comparison.

Updates to Markdown test data files:

  • Added <!-- {"layout":"title-and-body"} --> metadata:
    • Standardized layout metadata across multiple test files, including testdata/autolink.md, testdata/blockquote.md, testdata/bold_and_italic.md, testdata/br.md, testdata/code.md, and others, to ensure consistent rendering in tests. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]

@k1LoW k1LoW self-assigned this Jul 13, 2025
@k1LoW k1LoW force-pushed the reduce-testdata branch from 683367b to 5884486 Compare July 13, 2025 14:46
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@k1LoW k1LoW changed the title fix(compare): improve paragraph equality logic fix(compare): improve paragraph equality logic / reduce testdata(markdown pages) Jul 13, 2025
@k1LoW k1LoW force-pushed the reduce-testdata branch from 1ac71b8 to 4c9d578 Compare July 13, 2025 14:58
@github-actions
Copy link
Contributor

Code Metrics Report

main (ab90487) #243 (e0508c7) +/-
Coverage 35.6% 35.7% +0.0%
Code to Test Ratio 1:0.9 1:0.9 -0.1
Test Execution Time 9s 8s -1s
Details
  |                     | main (ab90487) | #243 (e0508c7) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          35.6% |          35.7% | +0.0% |
  |   Files             |             16 |             16 |     0 |
  |   Lines             |           2272 |           2275 |    +3 |
+ |   Covered           |            811 |            814 |    +3 |
- | Code to Test Ratio  |          1:0.9 |          1:0.9 |  -0.1 |
  |   Code              |           4606 |           4615 |    +9 |
  |   Test              |           4170 |           4170 |     0 |
+ | Test Execution Time |             9s |             8s |   -1s |

Code coverage of files in pull request scope (58.1% → 59.2%)

Files Coverage +/- Status
compare.go 59.2% +1.0% modified

Reported by octocov

@k1LoW k1LoW marked this pull request as ready for review July 13, 2025 15:08
@k1LoW k1LoW merged commit 87169d0 into main Jul 13, 2025
1 check passed
@k1LoW k1LoW deleted the reduce-testdata branch July 13, 2025 15:24
@github-actions github-actions bot mentioned this pull request Jul 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant