Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,7 @@ MIT
---

Built by 🦋 [SuperDoc — DOCX Editor and Agent SDK](https://superdoc.dev)

### Analytics privacy verification

For changes to the optional analytics controller or URL navigation, follow [the maintained consent runbook](docs/analytics-consent.md#required-privacy-follow-up-and-release-checks) and run the existing `bun run test:growth` checks. Mirror controller fixes between ooxml.dev and docxcorp.us, use matching site/project fixtures and retain exact source/build evidence before normal maintainer release. These checks use synthetic data and do not send analytics to production.
23 changes: 15 additions & 8 deletions apps/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,25 @@
<link rel="preload" href="/fonts/jetbrains-mono.woff2" as="font" type="font/woff2" crossorigin />
<link rel="stylesheet" href="/fonts/fonts.css" />

<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-JFTMJ85VCW"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-JFTMJ85VCW');
</script>
</head>
<body>
<span style="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0">ooxml.dev is an interactive reference for ECMA-376 (Office Open XML) — the standard behind .docx, .xlsx, and .pptx files. Built by the SuperDoc team, who implemented a native OOXML renderer from scratch. Features: live previews (edit XML, see it render in real-time using SuperDoc's native OOXML engine), implementation notes (documents real-world behavior where Microsoft Word diverges from the spec), semantic spec search (18,000+ spec chunks searchable by meaning via MCP server at api.ooxml.dev/mcp), and practical guides for paragraphs, tables, borders, bidirectional text, and document creation. The OOXML spec is 5,000+ pages of PDFs with no rendering guidance — this site bridges that gap with knowledge from people who actually implemented the spec. Covers WordprocessingML (the .docx subset). SuperDoc is open source at superdoc.dev. Built by Caio Pizzol (caiopizzol.com), Head of DX at SuperDoc.</span>
<div id="root"></div>
<section class="site-cookie-banner" data-consent-banner hidden aria-label="Cookie choices">
<div><p>Optional analytics cookies help us measure page views and clicks toward SuperDoc. They stay off until you choose.</p><a href="/privacy">Privacy and cookie choices</a><p data-consent-signal hidden>Your browser privacy signal keeps optional analytics off.</p></div>
<div class="site-cookie-actions"><button type="button" data-consent-accept>Accept analytics</button><button type="button" data-consent-reject>Reject analytics</button><button type="button" data-consent-open>Preferences</button></div>
</section>
<dialog class="site-cookie-dialog" data-consent-dialog aria-labelledby="site-cookie-title">
<h2 id="site-cookie-title">Cookie preferences</h2>
<p>Necessary storage saves your choice and supports essential site functions.</p>
<label class="site-cookie-purpose"><input type="checkbox" data-consent-analytics /><span><strong>Optional analytics</strong><br />Google Analytics measures page views and referral clicks. You can use the site without enabling it.</span></label>
<p data-consent-signal hidden>Your browser privacy signal keeps optional analytics off.</p>
<p data-consent-reload hidden>Turning analytics off reloads this page. Save any edits before continuing.</p>
<p><a href="/privacy">Privacy and cookie choices</a> · <a href="https://www.superdoc.dev/privacy-policy">SuperDoc privacy policy</a></p>
<footer><button type="button" data-consent-reject>Reject analytics</button><button type="button" data-consent-save>Save choices</button><button type="button" data-consent-close>Close</button></footer>
</dialog>
<footer class="site-privacy-footer"><a href="/privacy">Privacy and cookies</a><a href="/privacy#cookie-settings" data-consent-open>Cookie settings / Your privacy choices</a></footer>
<noscript><p>Optional analytics is off. <a href="/privacy">Read our privacy and cookie choices</a>.</p></noscript>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
3 changes: 3 additions & 0 deletions apps/web/public/_headers
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

/privacy.md
Content-Type: text/markdown; charset=utf-8
6 changes: 6 additions & 0 deletions apps/web/public/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,9 @@ Package metadata (curated from ECMA-376 Part 1 §11.3.x / §12.3.x / §13.3.x /
## About

ooxml.dev is built by SuperDoc (https://superdoc.dev). SuperDoc is the open source DOCX Editor and Agent SDK for reviewing, filling, and editing documents. Word-quality DOCX editing, built for your product. The implementation notes on ooxml.dev come from building that engine against thousands of real-world documents.

## Privacy and cookie choices

- [Privacy and cookie choices](https://ooxml.dev/privacy/)
- [Privacy notice as Markdown](https://ooxml.dev/privacy.md)
- Optional Google Analytics and referral events stay off until a choice on ooxml.dev. DNT and GPC keep them off. Cookie settings are available in every page footer.
10 changes: 10 additions & 0 deletions apps/web/scripts/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
* Usage: bun apps/web/scripts/prerender.ts
*/

import {
privacyTitle,
privacySections,
privacyLinks,
privacyMarkdown,
} from "../src/lib/privacy-content.mjs";
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { type DocPage, docs } from "../src/data/docs";
Expand Down Expand Up @@ -277,6 +283,8 @@ function buildHead(path: string): string {
function getContentHtml(path: string): string {
if (path === "/") return homePageHtml();
if (path === "/cli") return cliPageHtml();
if (path === "/privacy")
return `<main class="site-privacy-page"><a href="/">Back to ooxml.dev</a><h1>${escapeHtml(privacyTitle)}</h1><p>Cookie choices for ooxml.dev.</p>${privacySections.map((section) => `<section><h2>${escapeHtml(section.title)}</h2><p>${escapeHtml(section.text)}</p></section>`).join("")}<section id="cookie-settings"><h2>Cookie settings</h2><button type="button" data-consent-open>Open cookie settings</button></section><ul>${privacyLinks.map((link) => `<li><a href="${escapeHtml(link.href)}">${escapeHtml(link.label)}</a></li>`).join("")}</ul><p><a href="/privacy.md">Read this notice as Markdown</a></p></main>`;
if (path === "/mcp") return mcpPageHtml();
if (path === "/spec") return specPageHtml();

Expand Down Expand Up @@ -392,6 +400,8 @@ const notFoundHtml = render404Page();
writeFileSync(resolve(DIST, "404.html"), notFoundHtml);
console.log(` ✓ /404.html`);

writeFileSync(resolve(DIST, "privacy.md"), privacyMarkdown("ooxml.dev"));

// Generate sitemap
const sitemap = generateSitemap(paths);
writeFileSync(resolve(DIST, "sitemap.xml"), sitemap);
Expand Down
158 changes: 158 additions & 0 deletions apps/web/src/consent.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
[data-consent-banner][hidden],
[data-consent-signal][hidden],
[data-consent-reload][hidden] {
display: none !important;
}
.site-privacy-footer {
padding: 1rem;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 1.5rem;
font:
14px/1.6 system-ui,
sans-serif;
}
.site-privacy-footer a {
color: inherit;
text-decoration: underline;
text-underline-offset: 3px;
}
.site-cookie-banner,
.site-cookie-dialog {
box-sizing: border-box;
color: #1c1917;
background: #fff;
font:
15px/1.6 system-ui,
sans-serif;
overflow-wrap: anywhere;
}
.site-cookie-banner {
position: fixed;
z-index: 10000;
bottom: 1rem;
left: 1rem;
right: 1rem;
max-width: 66rem;
margin: 0 auto;
padding: 1.25rem;
border: 1px solid #a8a29e;
border-radius: 12px;
box-shadow: 0 8px 30px #0002;
display: flex;
align-items: center;
gap: 1.5rem;
max-height: calc(100dvh - 2rem);
overflow-y: auto;
}
.site-cookie-banner p,
.site-cookie-dialog p {
margin: 0 0 0.75rem;
}
.site-cookie-banner a,
.site-cookie-dialog a {
color: #9a3412;
text-decoration: underline;
}
.site-cookie-actions {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
flex-shrink: 0;
}
.site-cookie-actions button,
.site-cookie-dialog button {
min-height: 44px;
padding: 0.65rem 1rem;
border: 1px solid #57534e;
border-radius: 6px;
background: #fff;
color: #1c1917;
cursor: pointer;
font: inherit;
}
.site-cookie-actions button:hover,
.site-cookie-dialog button:hover {
background: #f5f5f4;
}
.site-cookie-actions button:disabled,
.site-cookie-dialog button:disabled {
cursor: not-allowed;
opacity: 0.6;
}
.site-cookie-banner :focus-visible,
.site-cookie-dialog :focus-visible,
.site-privacy-footer :focus-visible {
outline: 3px solid #c2410c;
outline-offset: 3px;
}
.site-cookie-dialog {
width: min(36rem, calc(100% - 2rem));
max-height: calc(100dvh - 2rem);
overflow: auto;
padding: 1.5rem;
border: 1px solid #a8a29e;
border-radius: 12px;
margin: auto;
}
.site-cookie-dialog::backdrop {
background: #0008;
}
.site-cookie-dialog h2 {
margin: 0 0 0.75rem;
font-size: 1.4rem;
font-weight: 650;
}
.site-cookie-purpose {
display: flex;
gap: 0.75rem;
margin: 1.25rem 0;
align-items: start;
}
.site-cookie-purpose input {
width: 1.25rem;
height: 1.25rem;
margin-top: 0.25rem;
accent-color: #9a3412;
}
.site-cookie-dialog footer {
display: flex;
gap: 0.75rem;
flex-wrap: wrap;
margin-top: 1.25rem;
}
.site-privacy-page {
max-width: 48rem;
margin: 0 auto;
padding: 3rem 1.25rem;
color: var(--color-text-primary, #1c1917);
line-height: 1.75;
}
.site-privacy-page h1 {
font-size: 2rem;
font-weight: 650;
margin: 1.25rem 0;
}
.site-privacy-page h2 {
font-size: 1.2rem;
font-weight: 650;
margin: 1.75rem 0 0.5rem;
}
.site-privacy-page a {
text-decoration: underline;
}
@media (max-width: 700px) {
.site-cookie-banner {
flex-direction: column;
align-items: stretch;
gap: 0.5rem;
padding: 1rem;
}
.site-cookie-actions {
flex-shrink: 1;
}
.site-cookie-actions button {
flex: 1 1 auto;
}
}
7 changes: 6 additions & 1 deletion apps/web/src/data/seo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export interface SeoMeta {
}

const staticPages: Record<string, SeoMeta> = {
"/privacy": {
title: "Privacy and cookie choices | ooxml.dev",
description: "How optional analytics and cookie choices work on ooxml.dev.",
type: "website",
},
"/": {
title: "ooxml.dev — The OOXML spec, explained by people who actually implemented it",
description:
Expand Down Expand Up @@ -60,7 +65,7 @@ export function getSeoMeta(path: string): SeoMeta {
}

export function getAllPaths(): string[] {
const paths = ["/", "/cli", "/mcp", "/spec", "/docs"];
const paths = ["/", "/cli", "/mcp", "/spec", "/docs", "/privacy"];
for (const slug of Object.keys(docs)) {
if (slug === "index") continue;
paths.push(`/docs/${slug}`);
Expand Down
30 changes: 30 additions & 0 deletions apps/web/src/lib/analytics-consent.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export type AnalyticsSiteHost = "ooxml.dev" | "docxcorp.us";
export type MeasurementId = `G-${string}`;
export interface ConsentChoice {
version: 1;
savedAt: number;
analytics: boolean;
}
export interface ConsentController {
readonly choice: ConsentChoice | null;
readonly blocked: boolean;
readonly reloadRequired: boolean;
save(analytics: boolean): ConsentChoice;
reconcile(fromStorage?: boolean): void;
}
export interface ConsentOptions {
measurementId: MeasurementId;
siteHost: AnalyticsSiteHost;
win?: any;
doc?: any;
clock?: () => number;
}
export const CONSENT_KEY: string;
export const CONSENT_MAX_AGE: number;
export function privacySignal(win: any): boolean;
export function validChoice(value: unknown, now?: number): ConsentChoice | null;
export function readConsent(win: any, now?: number): ConsentChoice | null;
export function publicSurface(location: { href: string }, siteHost: AnalyticsSiteHost): boolean;
export function clearAnalyticsCookies(doc: any, siteHost: AnalyticsSiteHost): void;
export function initializeAnalyticsConsent(options: ConsentOptions): ConsentController | null;
export function installConsentControls(options: ConsentOptions): ConsentController | null;
Loading
Loading