feat(blocklist): add site blocking and RFC documentation#31
Open
jamesainslie wants to merge 4 commits intomainfrom
Open
feat(blocklist): add site blocking and RFC documentation#31jamesainslie wants to merge 4 commits intomainfrom
jamesainslie wants to merge 4 commits intomainfrom
Conversation
The scoping approach (body.mdview-active *) created specificity conflicts with the universal reset, causing UI elements like the export menu and progress overlay to lose their padding and margins. Restores original unscoped selectors while preserving the blockquote left padding fix (0 1em -> 0 1em 0 1.5em) for better text separation from the border.
The TOC stripper runs during markdown rendering, so toggling the showToc preference requires a full page reload to strip or restore the original document TOC. Previously, the content script only showed/hid the MDView TOC sidebar without re-rendering, leaving the original TOC visible when enabled or missing when disabled.
Greptile OverviewGreptile SummaryThis PR adds a site blocklist feature allowing users to prevent markdown rendering on selected sites, plus bug fixes for TOC toggling and CSS scoping. The blocklist implementation supports exact domains, wildcard subdomains, path patterns, and full URLs with comprehensive test coverage. Key Changes:
Critical Issue Found:
Strengths:
Confidence Score: 2/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant ContentScript
participant FileScanner
participant Background
participant Storage
User->>ContentScript: Load markdown page
ContentScript->>Background: GET_STATE
Background->>Storage: Retrieve preferences
Storage-->>Background: Return state
Background-->>ContentScript: State with blockedSites[]
ContentScript->>FileScanner: isSiteBlocked(blockedSites)
FileScanner->>FileScanner: matchesPattern for each pattern
alt Site is blocked
FileScanner-->>ContentScript: true
ContentScript->>ContentScript: Skip rendering, exit
else Site not blocked
FileScanner-->>ContentScript: false
ContentScript->>ContentScript: activateStyles()
ContentScript->>ContentScript: Render markdown
end
User->>Popup: Toggle site block
Popup->>Background: UPDATE_PREFERENCES
Background->>Storage: Save blockedSites[]
Popup->>ContentScript: Reload tab
ContentScript->>FileScanner: isSiteBlocked (new blocklist)
|
| preferences.showToc !== this.state.preferences.showToc | ||
| ) { | ||
| debug.info('MDView', 'TOC preference changed, reloading page to re-render...'); | ||
| needsReload = true; |
There was a problem hiding this comment.
logic: needsReload used before declaration (line 636). This will cause a ReferenceError at runtime when toggling the TOC preference.
Suggested change
| needsReload = true; | |
| // Check for structural changes that require re-render | |
| let needsReload = false; | |
| // Handle TOC visibility toggle - requires reload to strip/restore original TOC | |
| if ( | |
| preferences.showToc !== undefined && | |
| this.state && | |
| preferences.showToc !== this.state.preferences.showToc | |
| ) { | |
| debug.info('MDView', 'TOC preference changed, reloading page to re-render...'); | |
| needsReload = true; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces a configurable site blocklist to MDView, allowing users to prevent markdown rendering on selected sites via URL patterns. It also adds RFC documentation for ongoing design work, refines UI styling, and fixes several bugs including CSS scoping issues and TOC toggle behavior.
Changes
Features
Site blocklist core logic
blockedSites?: string[]preference to the application state for site filteringFileScannersupporting:example.com)*.example.com)example.com/docs/*)Options UI for managing blocklist
Popup UI controls for per-site blocking
Fixes
showTocpreference changes to properly strip or restore the original document TOCcurrentHostwhen matching patternsreturn Promise.resolve()inprepareSvgsForPrintStyle
Documentation
RFC-20251202-001-docx-svg-support.mddocumenting SVG support in forked docx libraryRFC-20251203-001-mdview-semantic-block-dsl.mdspecifying HTML-comment-based semantic block DSLChores
Tests
getCurrentSiteIdentifier()Technical Details
FileScanner,content-script,popup,options,pdf-generatorblockedSites?: string[]inAppState.preferencesshowToctoggle now triggers page reload instead of just showing/hiding sidebarTesting
File Changes Summary
Checklist