Skip to content

About

A local-first script to compile LaTeX mathematics and brute-force the ADF JSON directly into Confluence.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Confluence LaTeX Injector

Atlassian Confluence is a JavaScript-infested SaaSS (Service as a Software Substitute) monolith that actively punishes engineers for attempting rigorous mathematical work.

While the traditional TeX ecosystem is itself a sprawling, decades-old monolith, it at least executes locally, processes mathematics with absolute precision, and stays out of your way. Confluence strips away this functional standard, replacing it with a dumbed-down web text box that suffocates your workflow beneath useless layers of abstraction.

If you are an engineer or cryptographer forced by corporate mandate to use this proprietary bloatware, you already know the tax it exacts. Confluence does not natively support LaTeX algorithms or TikZ diagrams. Relying on third-party "solutions" like the "Easy Math" macro is a mockery of modern computing, frequently taking upwards of 49 seconds just to render mathematics on the screen. Formatting a standard scientific specification by hand inside their browser editor can burn 20 hours of your life.

This script exists to stop that hemorrhage of time and compute.

It is a local-first automation script that relies on standard UNIX tools to compile your mathematics on your own iron, format it perfectly, and inject it directly into Confluence's backend database—entirely bypassing their incompetent web editor.

How It Bypasses the Bloat

Local Compilation: Extracts tikzpicture and algorithm environments and compiles them locally using pdflatex and standalone. It relies on your CPU, not a sluggish cloud server, to calculate exact bounding boxes and generate Retina-scaled PNGs.

Direct ADF Injection: Pandoc strips your LaTeX text into clean HTML. The script then pulls the proprietary Atlassian Document Format (ADF) JSON tree from their API and brute-forces the mathematical components directly into the database structure.

Smart Bounds: Confluence's web renderer will blindly stretch high-resolution images until they break the text column. This script uses Python's native struct module to read the PNG headers and inject maximum width constraints directly into the ADF nodes.

Prerequisites

This tool adheres to the UNIX philosophy: it chains together existing, single-purpose programs. You must have the following installed and accessible in your $PATH:

  • Python 3.8+
  • Pandoc: For standard text conversion.
  • TeX Live / MiKTeX: Providing pdflatex for local compilation.
  • Poppler: Providing pdftoppm for rapid PDF-to-image conversion.
  • texlive-extra-utils: Providing pdfcrop (Linux/Debian).

Installation

Clone the repository and install the minimal Python dependencies:

git clone [https://github.com/yourusername/confluence-latex-injector.git](https://github.com/yourusername/confluence-latex-injector.git)
cd confluence-latex-injector
pip install -r requirements.txt

Configuration

You must configure your Atlassian API credentials before running the script. Open confluence_injector.py and modify the configuration block:

CONFLUENCE_URL = "[https://your-domain.atlassian.net](https://your-domain.atlassian.net)"
CONFLUENCE_EMAIL = "your.email@company.com"
CONFLUENCE_API_TOKEN = "YOUR_ATLASSIAN_API_TOKEN"
SPACE_KEY = "YOUR_SPACE_KEY"
PAGE_TITLE = "Your Document Title"
PARENT_PAGE_ID = "12345678" 

Finding Your Confluence Identifiers

Confluence obfuscates its structural IDs, but you can extract them directly from your browser's URL bar:

  • SPACE_KEY: Navigate to the root of your target space. The URL will look like .../wiki/spaces/YOUR_SPACE_KEY/overview.
  • PARENT_PAGE_ID: Navigate to the specific folder or page where you want your new document to live. Look at the URL for a multi-digit integer: .../wiki/spaces/SPACE_KEY/pages/12345678/Page+Title. That integer (12345678) is your Parent ID.

Note: Do not commit your API token. In a sane environment, we wouldn't need proprietary cloud tokens to share documentation, but here we are.

Usage

Ensure your target LaTeX file is named README.tex and in the same folder as confluence_injector.py (or alter the hardcoded target in main()). Execute the script:

python confluence_injector.py

The script will compile your diagrams, establish an empty page in the walled garden, push the visual assets, and surgically alter the ADF JSON tree to render your mathematics natively.

Stop Subsidizing Bad Software

This project is open for pull requests. If you are tired of corporate crapware slowing down engineering output and want to improve this extraction tool, your contributions are welcome. Keep it fast, keep it local, and rely on standard text formats.

License

This project is released under the GPLv3 License. Retain your computing freedom.

About

A local-first script to compile LaTeX mathematics and brute-force the ADF JSON directly into Confluence.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages