Notes about Markdown issues and solutions
Summary
Markdown Code Blocks: Horizontal Scroll Issue on GitHub
- Displaying executable code that requires exact formatting and indentation
- Syntax highlighting improves clarity (e.g., python, javascript, html)
- Readers will copy and execute the code
- Example output or pasted text results
- Markup demonstrations (not meant to execute)
- Reference content readers will read, not run
- Content that benefits from natural text wrapping
Markdown-viewer Chrome extension
- Limited to the files you explicitly open
- Limited to Markdown files rendered through Chrome
- Not capable of arbitrary filesystem traversal on its own
Auto-converting plain text sections to markdown
Details
12 Feb 2026- In Markdown, \ escapes Markdown special characters (like *, _, [, etc.), not HTML
- Backslashes before HTML tags like \<a> may render inconsistently across different renderers
- VSCode preview might strip the backslash and display the tag, but GitHub might render it literally or differently
- HTML entities are universally recognized across all Markdown renderers (VSCode, GitHub, others)
- They render consistently as literal < and > characters everywhere
- This is the semantic HTML standard for displaying literal HTML code
Why code blocks don't wrap on GitHub:
- Intentional design decision: Code needs to preserve exact formatting. Indentation, spacing, and line alignment are semantic in code. Wrapping breaks that.
- It's standard behavior: Most code editors and platforms (VS Code, GitHub, Stack Overflow, etc.) follow this principle because code must be read exactly as written.
- The problem: GitHub doesn't distinguish between actual code and text output shown as code
- When you display example command output or pasted text, the non-wrapping constraint is overly restrictive
- A middle ground would be helpful: maybe a text or output code fence that wraps, separate from code fences that don't
- For your use case (showing what pasted output looks like), code blocks were never the right semantic choice anyway
- Blockquotes are actually MORE correct—they represent quoted/example content, which is exactly what your output is
- So the "fix" wasn't just a workaround; it's semantically better Markdown
- HTML code block – Will preserve formatting perfectly but causes GitHub's scrolling issue
- HTML entities in blockquotes – Displays the markup as readable text, wraps naturally, and is semantically correct for "example content"
- Use code blocks for actual executable code that needs exact formatting preserved
- Use HTML entities + blockquotes/regular text when you're showing markup as an example or reference—the user will read it, not run it
- "This is HTML markup" → should go in a code block
- "HTML code block with syntax highlighting" → easier to read the markup structure
- Result: colored tags, attributes, proper formatting
- Syntax highlighting and visual structure clarity
- GitHub's narrow viewport causing horizontal scrolling on mobile/responsive views
- That this was "example output" not "executable code"
- The user experience degradation
- Proper wrapping on all devices
- Semantic clarity (this is example content, not code to run)
- Better mobile experience
Markdown Code Blocks vs. Blockquotes: When to Use Each
- Displaying executable code that requires exact formatting and indentation
- Syntax highlighting improves clarity (e.g., python, javascript, html)
- Readers will copy and execute the code
- Example output or pasted text results
- Markup demonstrations (not meant to execute)
- Reference content readers will read, not run
- Content that benefits from natural text wrapping
- Fenced code blocks preserve formatting and typically do not wrap (hence GitHub’s horizontal scrollbar behavior).
- Outside code blocks (plain paragraphs, blockquotes, or inline text), raw </> may be treated as HTML by the renderer — use </> there to show literal tags.
- Inline code (`...`) also shows </> literally without escaping.or just ```) you do not need to escape < or >; the fence makes the contents literal (shown as code, not parsed as HTML), so tags are displayed, not interpreted.
- Single backticks (`...`) create an inline code span — monospace, code semantics, and typically a gray background. Use it for code, filenames, commands, or literal tokens (e.g., run(), README.md).
- Triple backticks ( ) create fenced code blocks — use for multi-line code with optional syntax highlighting (html, js).
- For emphasis/visual highlighting of ordinary text use *italic* or **bold**, not backticks.
- Inline code is rendered differently (semantically and visually) from emphasis; using it for non-code is misleading to readers.
- To include a backtick inside inline code, wrap with a longer fence, e.g. text [in earlier words, looks like some special characters were omitted] or use <code>...</code>.
- Good: npm install (command), src/index.js (filename)
- Emphasis: Important or note (not Important)) create fenced code blocks — use for multi-line code with optional syntax highlighting (html, js).
- For emphasis/visual highlighting of ordinary text use *italic* or **bold**, not backticks.
- Use inline code for: README.md, npm install, --help, run().
- Use bold/italic for emphasis or prose (not inline code).
- Don’t overuse inline code for long sentences or non-literal phrasing — it signals "literal/technical" to readers.
ChatGPT (CG): Short answer: Yes, it’s generally OK — with a small, well-understood risk.
Here’s a precise, security-focused explanation so you can decide comfortably.
What “access to file URLs” actually means
When you enable “Allow access to file URLs” for a Chrome extension, you are allowing that extension to:
Read only the local files you open through it (e.g.,
.mdfiles you double-click or open in Chrome)Process the contents of those files inside the browser
It does not mean:
Blanket access to all files on your disk
Background scanning of your filesystem
Arbitrary uploads of files without user action
Chrome’s security model still applies.
About Markdown Viewer specifically
Markdown Viewer is a long-standing, widely used extension whose sole purpose is:
Rendering Markdown to HTML
Locally, in the browser
Key points that reduce risk:
The functionality is purely client-side
No account, login, or cloud sync is involved
The extension only activates when you open a Markdown file
For viewing local Markdown notes or documentation, this is a very common and accepted setup.
Realistic risk assessment
Low risk if:
You are opening your own Markdown files
The files contain documentation, notes, or blog drafts
You trust the Chrome Web Store vetting process
Slight risk if:
You open highly sensitive Markdown files (passwords, private keys, secrets)
The extension were to become compromised in a future update (rare, but not impossible)
This risk exists for any file-handling extension, not just this one.
Best-practice recommendation (simple)
✅ It’s fine to enable file URL access
❌ Don’t open files containing secrets (API keys, passwords)
🔁 If you stop using it, disable or remove the extension
🛡️ For ultra-sensitive content, use a local Markdown viewer/editor instead
Bottom line
Yes — enabling file URL access for this Markdown Viewer extension is reasonable and safe for normal Markdown usage.
You are making a conscious, limited permission grant, not opening up your entire system.
If you want, I can also suggest:
A zero-extension workflow for Markdown preview, or
A comparison with VS Code’s built-in Markdown preview from a security perspective.
Your understanding is essentially correct
Given that:
You will open only non-sensitive Markdown files
You open them explicitly in Chrome
You granted “Allow access to file URLs” only for this purpose
Then even if the extension were to become malicious in the future, its practical reach would be:
Limited to the files you explicitly open
Limited to Markdown files rendered through Chrome
Not capable of arbitrary filesystem traversal on its own
So your core conclusion is sound.
The small but important nuance (for completeness)
Chrome extensions cannot independently crawl your disk.
However, technically:
Once a file is opened, the extension can read that file’s contents
From that file, it could follow links you click (e.g., relative links to other local
.mdfiles)
But this still requires your interaction:
You must open or click the file/link
It cannot silently expand scope in the background
So this does not change your risk model in any meaningful way for non-sensitive files.
Why Chrome’s model protects you here
Chrome enforces:
User-initiated file access
Origin isolation for
file://URLsPermission-scoped extension access
An extension does not get:
A list of your files
Directory enumeration privileges
Background file read permissions
Bottom line (very clearly)
Yes. Your understanding is correct.
Even in a worst-case scenario where the extension later becomes malicious, it can only act on the Markdown files you intentionally open in Chrome, and cannot go beyond that scope without further user action or additional permissions.
For your stated use case — non-sensitive Markdown viewing — this is a reasonable and low-risk choice.
If you ever want to tighten it further:
Disable the extension when not in use, or
Use a local viewer/editor instead
But based on what you described, you’re making a well-informed decision.
Me: One issue I faced with VSCode for a project with multiple markdown files that I wanted to preview simultaneously, is that preview always showed only one file.
CG: Yes — that observation is accurate, and it comes from how Visual Studio Code is designed.
Let me explain why this happens and what your real options are.
Why VS Code shows only one Markdown preview (by default)
VS Code’s Markdown preview is editor-bound, not document-bound.
By default:
Open Preview/Open Preview to the Sidereuses the same preview editorWhen you switch to another
.mdfile and open preview again:The existing preview tab is replaced
You don’t get a second independent preview
This is intentional behavior, not a bug.
VS Code treats Markdown preview like:
“a rendered view of the active editor”
not like separate browser tabs
What does work (but feels limited)
You can:
Open one file
Open Preview to the SideSplit the editor layout
But the moment you preview another Markdown file, the preview pane gets reused.
So your experience of “preview always showed only one file” is exactly correct.
Why this matters for your use case
Your use case is:
Multiple Markdown files
Wanting to see them rendered simultaneously
Likely for documentation or note comparison
VS Code is optimized for editing, not multi-document rendered viewing.
That’s why it feels constraining here.
Why your Chrome Markdown Viewer workaround makes sense
A browser-based Markdown viewer:
Treats each
.mdfile as a separate documentAllows:
Multiple tabs
Side-by-side windows
Independent scroll positions
This aligns much better with:
Reading
Comparing
Reviewing multiple Markdown files at once
So your choice is not just convenient — it’s architecturally appropriate.
Are there workarounds in VS Code?
Yes, but they’re clunky:
Extensions that force separate preview instances
Manually duplicating preview editors (unstable)
Using static-site generators just to preview content
None are as simple or reliable as browser tabs.
Bottom line
Your issue is real, expected, and rooted in VS Code’s design.
VS Code prioritizes editing workflows; browsers (with Markdown viewers) are better for multi-file rendered viewing.
Given your non-sensitive Markdown use case, your current approach is technically justified and practical.
If you want, I can also:
Suggest a zero-extension VS Code workflow that partially mitigates this, or
Compare VS Code vs browser Markdown viewing purely from a productivity angle.
=================
- By default the Content Theme was GITHUB which was showing markdown file content in light mode, despite Windows (OS) and Chrome being in dark mode and even while Dark Reader extension was On. Neither did chrome://flags -> Enable Force Dark Mode for Web Contents, change the content to dark mode.
The Quest for Clean Markdown: Converting Chat Logs
Moving conversation logs from a web chat interface into a local development environment like VS Code can be surprisingly difficult. While AI responses often have a "Copy" button that preserves Markdown formatting, user-sent messages are frequently treated as raw, plain text. This results in collapsed line breaks and broken formatting when pasted directly into a .md file.
The Trials
To solve this, I experimented with several "automatic" solutions within VS Code:
- Markdown All in One: A powerful suite for general editing, but it doesn't automatically "intercept" and reformat plain text during a standard paste.
- Paste as Markdown Extensions: I tested several extensions designed to convert clipboard data on the fly. While promising, they often required complex configurations, relied on specific metadata from the browser that wasn't always present, or had inconsistent "Paste As" UI behaviors that were prone to breaking after setting changes.
- VS Code Native "Paste As": While VS Code has built-in support for selecting paste formats, it often fails to recognize the intended structure of a plain-text block copied from a chat bubble.
- At times the 'VS Code Paste Widget' (blue icon with boxes and arrow) occasionally appeared to offer formatting choices. But it would not regularly appear for user messages copy.
- StackEdit is a great tool, but it doesn't "auto-convert" plain text into Markdown structure (like adding headings or bolding) because it's primarily an editor, not a parser.
- https://sitegpt.ai/tools/convert-paste-to-markdown adds some (possibly AI generated) stuff over and above the basic content I tried to convert. I did not want that.
- Then I got the solution given below.
The Solution: A Dedicated Parser
The most reliable and "cleanest" solution proved to be a dedicated web-based utility: clipboard2markdown.
By using this as a "cleaning station," the raw text is forced through a parser that correctly identifies carriage returns (CR), escapes special characters, and preserves the intended paragraph structure. This eliminates the manual labor of re-formatting lines and ensures that the final document in VS Code is clean, professional, and ready for publishing.
Comments
Post a Comment