Skip to content

feat: sync editor changes to a local Markdown file #24

Description

@RerankerGuo

Problem

Editor changes are currently persisted only in localStorage through
setMDContent. The bundled guide asks users to export a Markdown file and
import it again later.

This causes the browser content and a local Markdown source file to diverge.
It is especially confusing during local development: editing a resume in the
browser does not update the .md file used by the template, while editing the
file does not resolve an existing browser cache override.

Reproduction

  1. Start the current master branch with npm run dev.
  2. Open any resume template in the editor.
  3. Edit its Markdown content in the browser.
  4. Check the corresponding local .md source file.

Actual behavior

  • The source file is unchanged.
  • The edited content exists only under
    markdown-content-<template> in localStorage.
  • Keeping a durable local copy requires repeated manual export/import.

Expected behavior

Users should be able to explicitly link a local Markdown file and have later
editor changes written back to that file.

Proposed scope

Add an opt-in Sync local MD action using the browser File System Access
API:

  • require the user to select and grant access to a .md file;
  • handle differing editor/file content without silently overwriting either;
  • debounce subsequent editor writes to the selected file;
  • show whether local sync is active;
  • keep the existing import/export workflow as the fallback for unsupported
    browsers.

The browser cannot write arbitrary local paths without a user-granted file
handle, so automatic source-file discovery is intentionally out of scope.

Environment

  • CodeCV master at c06cb364
  • Reproduced in local development
  • Chromium-based browser

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions