惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
雷峰网
雷峰网
博客园 - 聂微东
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
博客园_首页
博客园 - 司徒正美
博客园 - 叶小钗
IT之家
IT之家
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
博客园 - 【当耐特】
宝玉的分享
宝玉的分享
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
Tailwind CSS Blog
V
V2EX
The Cloudflare Blog

Discourse Meta - Latest posts

Horizon: High Context Topic Cards I'd like to ask what this file /var/www/discourse/vendor/data/RT_sRGB.icm is used for? Discourse to Markdown Plugin Testing reply function How to verify a subdomain (mysite.discourse.group) in Google Search Console? Reader Mode Publishing WordPress gallery posts on Discourse Discourse User Feedback New user filter by custom field and contact Interact with discourse from Python? Why we can't type the assignee in the search of a post to assign - home screen app Redis Flushall Category-toggled one-touch move post Some sort of variable to eliminate duplicate text? Why did this plugin replacement fail? Add user to list modal often appears above the mobile viewport sceen Creating/Editing a post on mobile: let's discuss the 2026 Discourse experience Wp-discourse feature request - do not show comments with specific tag? Are there any good Chinese plugins? Discourse ID and 2FA Discourse MCP is here! Sample Forum to See Admin Features? I am unable to register for a free Discourse site Wikipedia Lookup Add text for /login (like js.create_account.disclaimer for /signup) How can i set disable Markdown & Default to Rich Text What's the background image size for the Welcome Banner? How do I enable Associated Accounts with 2FA? Hamburger toggle Cannot disable read-only mode on Free Plan
Support <span data-attribute> in the rich editor
@Canapin Coi · 2026-04-17 · via Discourse Meta - Latest posts

1

If I select some text on a single line and apply a wrap through the composer button, an inline wrap is applied. This works, though the last letter of the selected text is partially cropped out:

image

This is one way to create inline wraps, and it will be automatically converted as a block wrap if there’s no other content written on the same line.

The other one is <span data-attribute> and isn’t supported in the rich editor (data-attribute is being stripped out), though it’s fully supported in the markdown editor. Interestingly, this allowed syntax is not listed in discourse/frontend/pretty-text/addon/allow-lister.js at 3b13aaa003332e7bf056a6cbb2c0da0cf107a0fd · discourse/discourse · GitHub but rather in discourse/frontend/discourse-markdown-it/src/features/d-wrap.js at 3b13aaa003332e7bf056a6cbb2c0da0cf107a0fd · discourse/discourse · GitHub :slight_smile:

<span data-attribute> is documented on meta, and probably used in the wild outside my forum. It has the advantage of never being converted to a block element, even if there’s no other content on the same line.

A regular wrap alone on a line like this:

[wrap="fish"]text[/wrap]

Will be rendered as a block:

<div class="d-wrap" data-wrap="fish">
<p>text</p>
</div>

The only ways, to my knowledge, to avoid this behavior are:

  • Using <span data-attribute>:

    <span data-fish>text</span>
    

    renders as:

    <span data-fish="">text</span>
    
  • Add a non-trimmed (ideally zero-width) space like &ZeroWidthSpace; at the beginning or the end of the line.

    &ZeroWidthSpace;[wrap=fish]Fishyfishy[/wrap]
    

    renders as:

    &ZeroWidthSpace;<span class="d-wrap" data-wrap="fish">Fishyfishy</span>
    

The latter being a bit hacky.

I’d prefer being able to use the first solution in the rich editor. More generally, any kind of easy way to create an inline wrap would be good.