Skip to content

refactor, feat: support notationHightligh (close #50), feat: editing in live preview (close #19, about #44) #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 67 commits into
base: master
Choose a base branch
from

Conversation

LincZero
Copy link

@LincZero LincZero commented May 18, 2025

There are currently some problems with this PR:

This PR works

en

zh

  • 功能
    • 允许实时编辑
    • 支持注释标注的高亮、差异化、错误等级等
    • 添加mini版本 (9.4MB -> 5.0KB)
    • 展示语言类型,并也允许实时编辑
    • 新的选项:渲染方式
    • 新的选项:渲染引擎
    • 新的选项:自动保存方式 (用于实时编辑)
    • 可实时编辑的admonition (代码块版的callout)
  • 增强
    • 更新shiki版本:1.24.0 -> 3.4.2
  • 文档
    • 添加中文语言
    • 添加设置面板文档

TODO / Task

  • enhance
    • Excessive compilation size (This problem exists after the shiki version upgrade, and use from 'shiki' replace from 'shiki.mjs') (Because of the problems with bun and npm)
    • It might be necessary to add a new switch option.
    • [-] (option) a short-key to switch the current code block to the original state.
    • when cursor moves up and down (like Typora)
      • from textarea to root editor
      • [-] from root editor to textarea
    • select mul line use tab / shift tab
  • fix
    • editing in preview, should auto save
    • edit button z-index to low
    • meta highlight invalid
    • Fail to align when the last line is an blank line
    • black line zero height, influence background coloring
    • indent: match
    • indent: render, no treatment tabindex
    • edit: press tab key
  • feat
    • [-] (option) new option: allow custom language-type (langAlias, like dateview, dateviewjs, ...)
    • There is no need to edit the line where languageType is located in real time. This requires creating an independent textarea, just like typora.
    • New strategy: textarea / editablePre. The principle of editablePre does not use overlapping textare and pre. Rather, it's like my other project: https://linczero.github.io/obsidian-node-flow/
  • docs
  • style
    • style: p::selection {background-color; color} (Adaptive light and shade)
  • other
    • Just code2html directly, this might be a problem? (I'm not sure. At present, it seems that there aren't any problems. I'm not sure what the use is for those codes that I chose to jump out in advance and didn't use)

TODO / Task in nestVersion

  • All types of languages are allowed
  • (last) a short-key to switch the current code block to the original state.
  • (last) new option: allow custom language-type (langAlias, like dateview, dateviewjs, ...)

@LincZero LincZero changed the title feat: support notationHightligh (close #50) feat: support notationHightligh (close #50), feat: editing in live preview (about #44) May 19, 2025
@LincZero
Copy link
Author

LincZero commented May 19, 2025

QQ2025520-133147.mp4

I referred to the textarea on the https://shiki.style/ page. The principle is to stack textarea and pre together.

Warning

This strategy has a drawback: it is very susceptible to the influence of themes/plugins/styles, etc. Because it is necessary to ensure that the textarea and pre overlap perfectly; otherwise, the editing experience will not be good.

It's still the same display:

cebe2932502e47114ccb75f366379fc1

@LincZero LincZero changed the title feat: support notationHightligh (close #50), feat: editing in live preview (about #44) refactor, feat: support notationHightligh (close #50), feat: editing in live preview (about #44) May 19, 2025
@LincZero LincZero changed the title refactor, feat: support notationHightligh (close #50), feat: editing in live preview (about #44) refactor, feat: support notationHightligh (close #50), feat: editing in live preview (close #19, about #44) May 20, 2025
Copy link
Owner

@mProjectsCode mProjectsCode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain more closely what you are doing and why you are doing it. Please keep to existing coding conventions used in the plugin, please use the set-up formatter, and please keep comments to english.

@LincZero LincZero marked this pull request as draft May 20, 2025 09:34
@LincZero LincZero requested a review from mProjectsCode May 20, 2025 10:20
LincZero added 30 commits May 23, 2025 21:33
fix: can't save when cursor in codeblock and use short-key switch to source mode
rename, add global_isLiveMode_cache
default liveMode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants