One Markdown document, two ways to write
Write without working directly with Markdown source, while Markdown remains the authority for the document text. How Textend connects visible content, caret behavior, structural edits, and undo to support both direct writing and precise control.

Write directly, and keep the document in Markdown
In Textend, everyday writing can work directly with headings, paragraphs, lists, quotes, and tables. You edit readable content, with menus and shortcuts for formatting. Learning Markdown syntax or maintaining a separate preview window is not a prerequisite for writing.
The document text remains Markdown. Typing and structural edits need to become changes in that text, which also underlies the saved document. Markdown carries the draft during writing rather than being produced only by an export conversion at the end.
These are two values we want to preserve together. Direct editing reduces the burden of handling markup, while a text file provides a basis for finding, backing up, and continuing to work on the draft. Writers can stay in writing view, with source access available when precise inspection is wanted.
A single source of truth defines the authority for document text
Textend treats the Markdown text as the authority for content. Headings, list levels, and quote relationships are interpreted from it, and writing view presents those structures. Presentation can change without keeping separate drafts in writing and source views for later reconciliation.
This requires distinguishing document text, interpreted structure, and presentation. The text records words and markup. Interpretation identifies structures and their ranges. Presentation makes them readable and editable. The latter layers can have caches and interface state without becoming independent content versions that overwrite the document.
“Single” does not mean putting all application data inside the .md file. Discussion records, suggestion states, preferences, and file-management information have their own purposes. A clear authority for the document text lets the file remain useful while collaboration and interface features do their work.
Start with text so edits correspond to the document
Textend uses a text-centered foundation. CodeMirror 6 holds the Markdown text, selections, editing transactions, and history. Markdown parsing identifies content structure, on top of which we implement live presentation and structural editing. The foundation supplies shared text positions; the product still defines writing, selection, and editing behavior.
Direct editing and source editing can therefore operate on the same current text. Structural actions in writing view need to produce defined text changes. Character edits in source need to be interpreted as the current structure. That connection must hold throughout editing, not just when comparing saved results.
A text foundation does not automatically deliver live writing. Which marks to hide, how to cross structural boundaries, and how tables accept input still need explicit behavior. We take on that work so users can work directly with content while retaining a clear Markdown original.
Keep the caret at editable positions when syntax is hidden
Writing view hides some structural marks, so visible boundaries and source-character positions do not always coincide. Caret placement, clicks, arrow movement, and selection need to account for that relationship. Otherwise, users can enter hidden character ranges or press a key without seeing meaningful movement.
In writing mode, Textend handles visible content starts and structural boundaries, with navigation and selection rules for hidden-mark ranges. Writers need to understand where text goes and what the next input will do; the editor coordinates the underlying mark positions.
Source mode keeps characters editable. Marks, indentation, and incomplete syntax can be changed directly, with text-oriented key behavior. What the modes share is the document, rather than a requirement for every key to produce the same structural result.
Keep clicks and input aligned as content changes size
Live presentation includes content whose dimensions change. Image loading, equation rendering, wrapped table text, and font changes affect the positions of later text. When presentation updates, the editor’s understanding of content positions needs to follow so selection and input stay aligned with what is visible.
Textend handles occupied space, size updates, and click positions within shared layout rules. Spacing around content needs to count toward its occupied area. Asynchronous content managed by the editor needs to notify layout when measurement changes. Visible space and actual input positions need to stay consistent.
This work supports ordinary writing actions: selecting a sentence, clicking the next paragraph, and continuing after an object. Layout should aid reading while those actions continue to correspond to the document. That requires coordination between presentation and editing, beyond changing colors, borders, or visual styling.
Give structural and character editing their own clear intentions
Writing mode works with content structure. List items have parent–child relationships, quotes have ranges, and tables have rows and cells. Edits need to preserve relationships outside their scope. The editor has to identify which structure an action belongs to rather than relying on visual indentation or similar-looking text.
Source mode works with characters, lines, and marks. It allows direct changes to indentation and syntax, including temporarily incomplete content. Making the display immediately tidy should not turn a local character edit into a larger structural operation.
Textend therefore separates shared content from command behavior. The two views support different levels of work while applying their results to the same document. Authors can edit content directly day to day and inspect the original for precise control, without synchronizing two independent versions.
Switching modes should not become a document edit
Writing and source modes share editing history in Textend. Ordinary switching changes presentation and behavior without copying the text, clearing undo, or running a whole-document formatting pass. The other mode is another way to edit the current document.
Actual edits belong in the document and the corresponding undo transactions. Text changes required by a structural action need to be handled with that action, so undo can restore the earlier content state. Separating a view switch from a document change makes each action understandable.
Moving between views does not require every screen coordinate to remain identical. Mark visibility, wrapping, and type size affect layout. What needs to remain continuous is the document and editing history, with understandable, editable positions in the current mode.
Keep source access for precise control alongside direct writing
Source mode provides access to marks, indentation, links, and fences. It can be used for sustained writing or opened only for precise inspection. Users choose the level of control they want without needing to master the syntax before writing.
Opening a file, inspecting it, or switching modes does not normalize the whole document for display. After returning to writing mode, actual structural edits apply their rules to the areas they change. Inspection and editing have distinct boundaries.
Retaining Markdown has practical boundaries. Images still need their resources, extensions depend on the destination tool, and PDF and DOCX use their own delivery layouts. Live editing makes content easier to work with; it does not make every application, view, and exported file pixel-identical.
Keep the coordination inside the editor
One Markdown document needs to support readable presentation, accurate input, structural changes, and continuous editing history together. Those responsibilities determine whether direct writing is comfortable. Hiding syntax alone does not provide them.
Textend takes on that coordination so authors can concentrate on what they are expressing while retaining precise editing and a usable text file. Writing and source views provide complementary ways to work on the same current document.