Skip to content
Margent
Language
All guides

Publish from a repository

For owners · .margent.yml, the publish workflow, and direct push from the CLI.

How a document gets here

Your content stays in a git repository and is uploaded to Margent as it is. Markdown and CSV files need no build: Margent turns each Markdown file into a page and each CSV into a table you can sort, filter and comment on, cell by cell. PDFs are uploaded as they are too, and get a page where you comment on their text. Anything else you build yourself (a site generator, Marp slides, a LaTeX document) is uploaded as its output. Comments live here and never change the repository; your agent takes them back to the source.

Each kind of content has its own guide: Markdown pages, CSV tables, Marp slides, PDF and LaTeX and static sites and HTML.

A build reaches a project only when all three hold: the repository’s .margent.yml lists the project, the project is linked to that repository, and the branch is one of the project’s versions.

Set up a project

  1. New project: a name, a URL name and the GitHub repository (owner/repo).
  2. Link the repository. Public repositories are checked right away. For a private one, paste a read-only GitHub token for a one-time check, or let the first upload arrive and confirm it on the project page.
  3. Add .margent.yml at the root of the repository. The project page shows the exact file with this project’s id:
    server: https://…
    projects:
      - prj_…
    Several projects can be listed; secrets_allowlist takes paths or fingerprints of known false alarms.
  4. Copy the workflow file to .github/workflows/margent-publish.yml. It runs on a push to your versions’ branches (and by hand) and uploads with the publish action; add your build step only if you build HTML yourself. It signs in with GitHub’s OIDC token, so the repository needs no secrets. Give id-token: write only to the publish job and pin actions by commit.
  5. Push. The setup checklist ticks off Publish the first version when the build is in.

Comments that point at the source

Markdown and CSV that Margent renders carry their source lines already: every comment knows its file and line, the panel shows “line 8”, and your agent goes straight to the spot. If you render Markdown yourself, keep the source positions (data-sourcepos, for example markdown-it with a sourcepos plugin, cmark --sourcepos, or Marp with the same plugin). A manifest.json in the build can name each page’s title, kind and source file. A PDF built from LaTeX gets its .tex lines through SyncTeX (see PDF and LaTeX).

Direct push from your machine

  1. An owner turns on Direct push in the project’s Settings. It is off by default.
  2. Sign the CLI in once. It opens the browser, where you choose the projects; the push token it gets is saved on your machine. It can only publish; it never reads or writes comments.
    margent login --server https://…
    Over SSH, the CLI shows a link and asks for the code the page shows. In CI, create a push token under Account → Connect your agent → Push token for the CLI and set it as MARGENT_TOKEN.
  3. From a checkout of the linked repository, run:
    margent push .

margent logout revokes the saved token and removes it from your machine.

Push . for Markdown and CSV, or your build’s output folder (for example dist). Files your .gitignore leaves out are not uploaded. Owners and editors can push. The CLI waits for the checks and prints which projects took the build. Builds from a checkout with uncommitted changes are marked dirty, and every direct push is labelled as such.

Good to know

  • Every build is scanned for passwords and keys. A build with a finding is refused, with the file, line and rule (never the secret).
  • Anyone with write access to the linked repository can publish to its configured branches.
  • Content root in Settings serves only a folder of the build, for example docs/.