Describe the bug
When using the Obsidian Web Clipper to capture posts from x.com (formerly Twitter), the line breaks within the tweet text are entirely missing/swallowed in the generated Markdown. The entire tweet content is squeezed into a single continuous block of text, making it difficult to read.
To Reproduce
- Install the official Obsidian Web Clipper extension.
- Navigate to any multi-paragraph post on X, for example:
https://x.com/AndrewYNg/status/2071988145667928442
- Click the clipper extension icon and view the preview using the default template (or any template using default
{{content}} / |markdown filter).
- Notice that all paragraph breaks and line breaks from the original tweet have disappeared.
Expected behavior
The clipped Markdown should respect and preserve the original line breaks/paragraphs of the tweet, matching the layout displayed on the webpage.
Environment & Context
- Platform/OS: macOS / Windows / Linux
- Browser: Chrome / Edge / Brave / Firefox (Choose your browser)
- Extension Version: [e.g., v1.0.x - check your extension version]
Additional Context & Technical Insights
The root cause stems from how x.com renders text layouts in its modern frontend architecture:
- X doesn't use standard
<p> or <br> tags for line breaks inside the tweet body. Instead, it relies on nested structural <div> / <span> elements combined with CSS properties (like white-space: break-spaces) to visually render breaks.
- The default HTML-to-Markdown converter (like
Turndown used under the hood) fails to recognize these CSS-driven visual breaks and strips them away, concatenating everything into a single line.
Current Workaround:
As a temporary fix, using a custom selector to extract raw text bypassing the default HTML converter works perfectly because the browser's text API natively translates those CSS breaks into standard \n characters:
{{selector:div[data-testid="tweetText"]|first}}
Describe the bug
When using the Obsidian Web Clipper to capture posts from
x.com(formerly Twitter), the line breaks within the tweet text are entirely missing/swallowed in the generated Markdown. The entire tweet content is squeezed into a single continuous block of text, making it difficult to read.To Reproduce
https://x.com/AndrewYNg/status/2071988145667928442{{content}}/|markdownfilter).Expected behavior
The clipped Markdown should respect and preserve the original line breaks/paragraphs of the tweet, matching the layout displayed on the webpage.
Environment & Context
Additional Context & Technical Insights
The root cause stems from how
x.comrenders text layouts in its modern frontend architecture:<p>or<br>tags for line breaks inside the tweet body. Instead, it relies on nested structural<div>/<span>elements combined with CSS properties (likewhite-space: break-spaces) to visually render breaks.Turndownused under the hood) fails to recognize these CSS-driven visual breaks and strips them away, concatenating everything into a single line.Current Workaround:
As a temporary fix, using a custom selector to extract raw text bypassing the default HTML converter works perfectly because the browser's text API natively translates those CSS breaks into standard
\ncharacters: