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 34 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版本
    • 展示语言类型,并也允许实时编辑
    • 新的选项:渲染方式
    • 新的选项:渲染引擎
  • 增强
    • 更新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.
  • 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.
  • docs
  • 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

  • New strategy: editablePre. The principle does not use overlapping textare and pre. Rather, it's like my other project: https://linczero.github.io/obsidian-node-flow/
  • Cursor moves up and down, it directly enters the textarea area instead of displaying the source code (like Typora)
  • All types of languages are allowed
  • style: p::selection {background-color; color} (Adaptive light and shade)
  • (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
Copy link
Author

LincZero commented May 20, 2025

I pressed the wrong… 😢 don't review for now.

@LincZero LincZero marked this pull request as ready for review May 23, 2025 05:22
@LincZero
Copy link
Author

LincZero commented May 23, 2025

Review note

  • Switching renderMode.codemirror in the Settings is the original behavior of the plugin. (If you merge, you can choose to modify this option back to the codemirror option)
  • You can test the behavior of the min version. It's also very useful.
  • I hope to create an organization and add a min sub-project to release the min version. If possible, add me to the organization members.

图片

A review item I haven't modified: obsidian docuemnt api

Although I know that obsidian provides a more convenient document api, I used to like using him too. It was very convenient.

But I didn't use it here because I will encapsulate it into a universal module unrelated to obsidian later (for my use in other projects).

Yes, an editable textarea encapsulated based on shiki/prism component, should be independent of obsidian.

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