Hi @Cimbali, thank you for this great extension!
I have noticed a layout "jump" (flash of unstyled content) when opening markdown files. The raw markdown text is briefly visible before the extension replaces it with the rendered HTML.
Root cause
The content_scripts in manifest.json does not specify run_at, so it defaults to document_idle. This means:
- Firefox loads and displays the raw markdown text
- The content script runs after the page is idle
- The rendered article replaces the raw text → visible layout shift
Proposed fix
Add "run_at": "document_start" to the content_scripts entry in manifest.json, so the script runs before the browser paints the raw text.
Alternatively, inject early CSS via a separate content script at document_start to hide <pre> content until the extension renders it:
/* Hide raw markdown until extension renders it */
pre { visibility: hidden !important; }
article { visibility: visible !important; }
@keyframes reveal { to { visibility: visible; } }
pre { animation: reveal 2s forwards; }
Environment
- Markdown Viewer Webext 1.0.1
- Firefox 152.0
- OS: Linux Mint 22.3 (1920x1080)
This is the same issue reported for MD Reader: md-reader/md-reader#156
Would you consider implementing one of these options?
Thanks!
Hi @Cimbali, thank you for this great extension!
I have noticed a layout "jump" (flash of unstyled content) when opening markdown files. The raw markdown text is briefly visible before the extension replaces it with the rendered HTML.
Root cause
The
content_scriptsinmanifest.jsondoes not specifyrun_at, so it defaults todocument_idle. This means:Proposed fix
Add
"run_at": "document_start"to the content_scripts entry inmanifest.json, so the script runs before the browser paints the raw text.Alternatively, inject early CSS via a separate content script at
document_startto hide<pre>content until the extension renders it:Environment
This is the same issue reported for MD Reader: md-reader/md-reader#156
Would you consider implementing one of these options?
Thanks!