No description
  • TypeScript 95.8%
  • JavaScript 1.9%
  • Shell 1.9%
  • Ruby 0.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Johannes Wilm bed05b3ee4
Some checks are pending
Tests / test (20) (push) Waiting to run
Tests / test (22) (push) Waiting to run
0.1.19
2026-07-25 21:34:25 +02:00
.github/workflows Add test suite 2026-06-29 10:25:37 +02:00
.husky Set up pre-commit hooks and Codeberg Pages deploy 2026-07-15 20:46:48 +02:00
demo Set up pre-commit hooks and Codeberg Pages deploy 2026-07-15 20:46:48 +02:00
packaging Initial release of @fiduswriter/cli@0.1.0 2026-06-29 00:54:57 +02:00
scripts Set up pre-commit hooks and Codeberg Pages deploy 2026-07-15 20:46:48 +02:00
src switch to pnpm 2026-07-22 18:11:02 +02:00
templates Initial release of @fiduswriter/cli@0.1.0 2026-06-29 00:54:57 +02:00
test TS any => 2026-07-15 09:35:03 +02:00
.gitignore Initial release of @fiduswriter/cli@0.1.0 2026-06-29 00:54:57 +02:00
.prettierignore Add fwtoolkit lint/format setup and fidusconvert book command 2026-07-02 22:25:34 +02:00
.prettierrc.json Add fwtoolkit lint/format setup and fidusconvert book command 2026-07-02 22:25:34 +02:00
AGENTS.md switch to pnpm 2026-07-22 18:11:02 +02:00
eslint.config.mjs Add fwtoolkit lint/format setup and fidusconvert book command 2026-07-02 22:25:34 +02:00
INSTALL.md Initial release of @fiduswriter/cli@0.1.0 2026-06-29 00:54:57 +02:00
LICENSE Initial release of @fiduswriter/cli@0.1.0 2026-06-29 00:54:57 +02:00
logo.svg Initial release of @fiduswriter/cli@0.1.0 2026-06-29 00:54:57 +02:00
package.json 0.1.19 2026-07-25 21:34:25 +02:00
pnpm-lock.yaml switch to pnpm 2026-07-22 18:11:02 +02:00
README.md 0.1.4: allow piping 2026-06-29 12:57:04 +02:00
tsconfig.json Initial release of @fiduswriter/cli@0.1.0 2026-06-29 00:54:57 +02:00

@fiduswriter/cli

fidusconvert logo

Command-line tool for converting documents between Fidus Writer native format (.fidus) and other document formats. Built on top of @fiduswriter/document.

Install

npm install -g @fiduswriter/cli

See INSTALL.md for platform-specific packages (Debian, Arch, Fedora, macOS Homebrew) and building from source.

Update

If you installed the package globally with npm, update it to the latest version with:

npm install -g @fiduswriter/cli@latest

Usage

Convert documents

The convert command is the default and handles all format conversions:

# .fidus → DOCX
fidusconvert document.fidus output.docx

# DOCX → .fidus
fidusconvert input.docx output.fidus

# DOCX → LaTeX (explicit format flags)
fidusconvert --from docx --to latex input.docx output.latex.zip

# .fidus → HTML with a custom citation style
fidusconvert -s chicago-author-date document.fidus output.html.zip

# .fidus → DOCX with a custom template
fidusconvert --docx-template my-template.docx document.fidus output.docx

# .fidus → JATS with book-part-wrapper type
fidusconvert --jats-type book-part-wrapper document.fidus output.jats.zip

Pipe through stdin/stdout

Use - as the input or output path to read from stdin or write to stdout. When - is used, the format must be given explicitly with --from or --to.

# Markdown → Pandoc JSON → Fidus Writer
pandoc -f markdown -t json input.md | fidusconvert --from pandoc --to fidus - output.fidus

# Fidus Writer → raw Pandoc JSON → Markdown
fidusconvert --from fidus --to pandoc input.fidus - | pandoc -f json -t markdown

# .fidus → DOCX on stdout (binary, redirect to a file)
fidusconvert --from fidus --to docx input.fidus - > output.docx

Status messages are written to stderr so they do not mix with piped output.

When exporting to --to pandoc -, the raw Pandoc JSON document is emitted on stdout (not the usual .pandoc.json.zip archive). For all other formats the binary archive is written directly to stdout.

Inspect a .fidus file

fidusconvert info document.fidus

This prints the file's MIME type, format version, document title, language, paper size, citation style, image and bibliography counts, and a listing of all files inside the .fidus archive.

Options

Option Description
--from <format> Input format (auto-detected from extension if omitted)
--to <format> Output format (auto-detected from extension if omitted)
-s, --style <style> Citation style: apa, chicago-author-date, ieee, etc. (default: apa)
--docx-template <path> Custom DOCX template file
--odt-template <path> Custom ODT template file
--jats-type <type> JATS type: article, book-part-wrapper, book (default: article)

Supported formats

Format Read Write Extension
Fidus Writer yes yes .fidus
DOCX yes yes .docx
ODT yes yes .odt
LaTeX yes .latex.zip
HTML yes .html.zip
EPUB yes .epub
JATS yes .jats.zip
Pandoc JSON yes yes .json / .pandoc.json.zip

Dependencies

Development

npm install
npm run build

Tests

The full test suite uses Pandoc to generate DOCX, ODT and Pandoc-JSON fixtures from Markdown sources and to cross-check exported files. Make sure Pandoc is installed before running the tests:

# Debian/Ubuntu
sudo apt-get install pandoc

# macOS
brew install pandoc

Run all tests:

npm test

If Pandoc is unavailable, the core CLI tests in test/convert.test.ts can be run directly:

npx tsx test/convert.test.ts

The test suite covers:

  • All supported export formats from .fidus files.
  • Import of DOCX, ODT and Pandoc JSON files into .fidus.
  • A full conversion matrix (Markdown → DOCX/ODT/JSON → .fidus → every output format) with content checks.
  • Pre-existing DOCX and ODT fixtures, including files with tracked changes, comments, footnotes and citation-manager fields.
  • Synthetic DOCX files built from citation-manager word/document.xml fragments (Zotero, Mendeley, EndNote and Word-native bibliographies), with Word-native sources bundled as customXml/item1.xml.
  • Synthetic ODT files built from citation-manager content.xml fragments (Zotero reference marks and LibreOffice native bibliography marks).

License

AGPL-3.0-or-later