obsidian想像typore那样的软换行和硬换行,如何设置

obsidian想像typore那样的软换行和硬换行,如何设置,添加css设置,只有在编辑模式下生效,预览模式下不生效,修改了无数遍还是不行。然后尝试使用插件,插件也是不管用。各位有什么好的方法吗

不知道是不是你的需求。
我用这个代码模拟typora的显示效果,可以使两段间的“空行”看起来更窄一点,而不是像一整行正常行高那么高。

/* ==============================
   1. 编辑模式 / 实时预览 (Live Preview)
   ============================== */
/* 针对仅包含换行符的行进行压缩 */
.cm-line:has(br) {
    line-height: 0.6em !important;
    /* 同时移除内边距,确保压缩效果更明显 */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* ==============================
   2. 阅读模式 (Reading View)
   ============================== */
/* 在阅读模式下,没有 ".cm-line"。
   视觉上的“空行”通常是段落(p)之间的间距(margin)。
   缩小段落底部的外边距。
*/
.markdown-rendered p {
    margin-bottom: 0.6em !important; 
    margin-top: 0 !important;
}

/* 特殊情况:针对显式的 <br> 标签(例如连续换行产生的)
   注意:这可能会影响段落内的软换行(Shift+Enter),请根据需求保留或删除
*/
.markdown-rendered br {
    display: block;
    content: "";
    margin-top: 0.3em; 
    line-height: 0.3em;
}