Skip to content

Hide YAML front matter instead of rendering as HTML table#312

Merged
schuyler merged 1 commit into
mainfrom
claude/resolve-issue-307-eBVOn
Feb 18, 2026
Merged

Hide YAML front matter instead of rendering as HTML table#312
schuyler merged 1 commit into
mainfrom
claude/resolve-issue-307-eBVOn

Conversation

@schuyler

Copy link
Copy Markdown
Owner

Summary

  • Fix contentOffset bug: Consume trailing newlines after the closing ---/... delimiter so Hoedown doesn't misinterpret residual text (e.g., treating content as a title)
  • Hide frontmatter from preview: Pass nil instead of [frontMatter HTMLTable] to MPHTMLFromMarkdown() — when "Hide YAML front matter" is ON, frontmatter is completely hidden from the preview pane (matching VS Code behavior)
  • Rename UI label: "Detect Jekyll front-matter" → "Hide YAML front matter" in XIB and all 18 localization files
  • Enable by default: Add htmlDetectFrontMatter = YES to migration v3 so existing and new users get frontmatter hidden by default

Related Issue

Related to #307

Manual Testing Plan

  • Verify frontmatter is completely hidden from preview when preference is ON
  • Verify --- delimiters render as horizontal rules when preference is OFF
  • Verify heading immediately after ---\n (no blank line) renders as <h1> (contentOffset fix)
  • Verify ... closing delimiter is handled correctly
  • Verify documents without frontmatter are unaffected
  • Verify preference toggle updates preview live without restart
  • Verify "Hide YAML front matter" checkbox label in Preferences > Rendering
  • Verify migration enables preference for users upgrading from v2
  • Verify explicit user disable choice is preserved at v3

Test Coverage

14 new tests across 3 test files:

  • 6 tests in MPStringLookupTests.m (contentOffset trailing newline consumption)
  • 5 tests in MPRendererEdgeCaseTests.m (frontmatter hidden, no table, OFF behavior)
  • 3 tests in MPPreferencesTests.m (migration, fresh install, user choice preserved)

All 4 CI jobs pass (macOS 14, 15, 26, 15-intel).

Review Notes

  • Reuses migration v3 (not shipped in a release) rather than adding v4
  • NSObject+HTMLTabularize code remains in codebase but is no longer used in the rendering path
  • Internal preference key htmlDetectFrontMatter is unchanged

https://claude.ai/code/session_01TPXyihtEP28tBwYdjzPWzV

- Fix contentOffset bug: consume trailing newlines after closing
  delimiter so Hoedown doesn't misinterpret residual text
- Stop rendering frontmatter as HTML table: pass nil to
  MPHTMLFromMarkdown() instead of [frontMatter HTMLTable]
- Rename UI label from "Detect Jekyll front-matter" to
  "Hide YAML front matter" in XIB and all 18 localization files
- Add htmlDetectFrontMatter = YES to migration v3 so existing
  users get frontmatter hidden by default
- Add tests for contentOffset fix, hidden frontmatter rendering,
  and migration behavior

Related to #307

https://claude.ai/code/session_01TPXyihtEP28tBwYdjzPWzV
@github-actions

github-actions Bot commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Report

Current Coverage: 54.64%

Coverage Details (Summary)
Name                                                                                                                                   Coverage            
-------------------------------------------------------------------------------------------------------------------------------------- ------------------- 
MASPreferences.bundle                                                                                                                  0.00% (0/0)         
MacDown 3000.app                                                                                                                       59.28% (7885/13301) 
    /Users/runner/work/macdown3000/macdown3000/Dependency/peg-markdown-highlight/HGMarkdownHighlighter.m                               85.51% (478/559)    
        styleparsing_error_callback                                                                                                    90.00% (9/10)       
        -[HGMarkdownHighlighter init]                                                                                                  92.86% (13/14)      
        -[HGMarkdownHighlighter initWithTextView:]                                                                                     83.33% (5/6)        
        -[HGMarkdownHighlighter initWithTextView:waitInterval:]                                                                        83.33% (5/6)        
        -[HGMarkdownHighlighter initWithTextView:waitInterval:styles:]                                                                 83.33% (5/6)        
        -[HGMarkdownHighlighter parseText:]                                                                                            100.00% (9/9)       
        -[HGMarkdownHighlighter convertOffsets:text:]                                                                                  26.19% (11/42)      
        -[HGMarkdownHighlighter requestParsing]                                                                                        100.00% (15/15)     
        __39-[HGMarkdownHighlighter requestParsing]_block_invoke                                                                       100.00% (12/12)     
        __39-[HGMarkdownHighlighter requestParsing]_block_invoke.11                                                                    100.00% (3/3)       
        __39-[HGMarkdownHighlighter requestParsing]_block_invoke.13                                                                    100.00% (4/4)       
        -[HGMarkdownHighlighter getClearFontTraitMask:]                                                                                88.89% (16/18)      
        -[HGMarkdownHighlighter clearHighlightingForRange:]                                                                            100.00% (31/31)     
        __51-[HGMarkdownHighlighter clearHighlightingForRange:]_block_invoke                                                           100.00% (8/8)       
        -[HGMarkdownHighlighter readClearTextStylesFromTextView]                                                                       100.00% (17/17)     
        -[HGMarkdownHighlighter applyHighlighting:withRange:]                                                                          80.00% (60/75)      
        __53-[HGMarkdownHighlighter applyHighlighting:withRange:]_block_invoke                                                         92.31% (12/13)      
        -[HGMarkdownHighlighter applyVisibleRangeHighlighting]                                                                         100.00% (16/16)     
        -[HGMarkdownHighlighter clearHighlighting]                                                                                     100.00% (3/3)       
        -[HGMarkdownHighlighter cacheElementList:]                                                                                     100.00% (6/6)       
        -[HGMarkdownHighlighter clearElementsCache]                                                                                    100.00% (2/2)       
        -[HGMarkdownHighlighter textViewTextDidChange:]                                                                                0.00% (0/11)        
        __47-[HGMarkdownHighlighter textViewTextDidChange:]_block_invoke                                                               0.00% (0/3)         
        -[HGMarkdownHighlighter textViewDidScroll:]                                                                                    100.00% (11/11)     
        __43-[HGMarkdownHighlighter textViewDidScroll:]_block_invoke                                                                   100.00% (6/6)       
        __43-[HGMarkdownHighlighter textViewDidScroll:]_block_invoke_2                                                                 100.00% (3/3)       
        -[HGMarkdownHighlighter getDefaultStyles]                                                                                      100.00% (27/27)     
        -[HGMarkdownHighlighter applyStyleDependenciesToTargetTextView]                                                                92.86% (13/14)      
        -[HGMarkdownHighlighter setStyles:]                                                                                            100.00% (8/8)       
        -[HGMarkdownHighlighter getDefaultSelectedTextAttributes]                                                                      100.00% (7/7)       
        -[HGMarkdownHighlighter handleStyleParsingError:]                                                                              100.00% (12/12)     
        -[HGMarkdownHighlighter applyStylesFromStylesheet:withErrorHandler:]                                                           86.05% (74/86)      
        -[HGMarkdownHighlighter setTargetTextView:]                                                                                    100.00% (7/7)       
        -[HGMarkdownHighlighter parseAndHighlightNow]                                                                                  100.00% (3/3)       
        -[HGMarkdownHighlighter highlightNow]                                                                                          100.00% (3/3)       
        -[HGMarkdownHighlighter activate]                                                                                              100.00% (24/24)     
        -[HGMarkdownHighlighter deactivate]                                                                                            100.00% (18/18)     
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Extension/NSColor+HTML.m                                                   94.05% (332/353)    
        +[NSColor(HTML) colorWithHexString:]                                                                                           94.12% (16/17)      
        +[NSColor(HTML) colorWithHTMLName:]                                                                                            89.13% (164/184)    
        __35+[NSColor(HTML) colorWithHTMLName:]_block_invoke                                                                           100.00% (152/152)   
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Utility/FileURLInlining.m                                                  26.60% (25/94)      
        +[FileURLInlining inlineFromIterable:]                                                                                         0.00% (0/11)        
        -[FileURLInlining initWithURL:]                                                                                                0.00% (0/6)         
        -[FileURLInlining init]                                                                                                        100.00% (3/3)       

... (2611 more lines truncated)

📊 **Full coverage report available in workflow artifacts**

@schuyler schuyler merged commit 1eb1a29 into main Feb 18, 2026
9 checks passed
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