nextcloud / nextcloud/text

Detect changes to markdown syntax and open in code editing mode

Open
#3,477 8 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop discuss enhancement technical debt
Dominant language
JavaScript
Stars
659
Forks
133
Avg merge
1d 20h
Merged PRs (30d)
110

Description

Splitting out an idea laid out in https://github.com/nextcloud/text/issues/593#issuecomment-1323244299 as suggested by @PhrozenByte in https://github.com/nextcloud/text/issues/593#issuecomment-1324202910

Background

We want to enable the best possible editing experience to users while making sure that markdown syntax is preserved for those who care about it by default. There's a long discussion about this in #593.

A lot of work is going into preserving the markdown syntax already but the architecture of texts wysiwyg editing and limitations of the underlying libraries make it close to impossible to preserve all syntax out there.

Proposal

(updated to match the current state of discussion)

  • When opening a .md file... check if it would be serialized to the same code.
  • If serializing the document would change the syntax open the document in code editing mode.
  • Have an info, why there's no wysiwyg functionality.

Possible Additions

  • It would be good to allow switching to wysiwyg - but that would not be required for a start from my point of view.
  • Make the syntax match the source as close as possible. If we manage to match the syntax we can have wysiwyg more often.

Alternatives

Previous proposal

So for those documents that would be altered when saved by text I propose the following default behavior:

  • detect if a file would be serialized differently and ask the user how they want to proceed:
    • open read only
    • open as code
    • open as rich text and accept the changes

The desired behavior could be customized by the user ("Do not ask me again") or per instance to avoid asking the user all together.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked discussion in #593, then trace how .md files are opened and how documents are serialized. The intended result is to detect serialization changes and open affected documents in code editing mode, with an explanation that WYSIWYG editing is unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.