From d11b2997612958bb016337f5aab060412f246bf8 Mon Sep 17 00:00:00 2001 From: OKAN TIKTAS <346542017+OKAN-SOFTWARE@users.noreply.github.com> Date: Tue, 1 Dec 2026 17:07:49 -0500 Subject: [PATCH] =?UTF-8?q?Rewrite=20the=20browser=20demo=20guide=20in=20t?= =?UTF-8?q?he=20maintainer=E2=80=99s=20voice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/WEB-DEMO.md | 77 +++++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 31 deletions(-) diff --git a/docs/WEB-DEMO.md b/docs/WEB-DEMO.md index a48be1d..034de37 100644 --- a/docs/WEB-DEMO.md +++ b/docs/WEB-DEMO.md @@ -1,52 +1,67 @@ # Browser demo and website deployment -The public-facing homepage route is `https://okantiktas.com/projects/doc2faq/`. Its **interactive demo** lives at `https://okantiktas.com/projects/doc2faq/demo/`. The portfolio's existing singular convention, `/project/doc2faq/`, redirects to the product homepage. The approved light, outlined, illustrated design is documented in [DESIGN-SYSTEM.md](DESIGN-SYSTEM.md). +I built the browser demo so you can try Doc2FAQ without installing Java. On my site, you can open a document, draft FAQs, check each answer against its source, and export the result. Start at the [Doc2FAQ homepage](https://okantiktas.com/projects/doc2faq/) or go straight to the [browser demo](https://okantiktas.com/projects/doc2faq/demo/). + +I keep the older [portfolio link](https://okantiktas.com/project/doc2faq/) working as a redirect to the homepage. I document the shared visual style in the [design system](DESIGN-SYSTEM.md). ## What visitors can try -| Capability | Browser demo | Java app from current source | +The demo and Java app share the review workspace. I use simpler drafting rules in the browser, so the two versions can suggest different questions from the same document. The live demo can also include changes that ship in a later Java release. + +| Capability | Browser demo | Local Java app | | --- | --- | --- | -| Paste text, import TXT/Markdown | Yes; all drafting runs in the browser | Yes; drafts processed by local Java server | -| Extract explicit Q&A | Simplified JavaScript rules | Java extraction service | -| Suggest questions from sections | Simplified Markdown-heading rules | Java generation service, with broader heuristics | -| Source viewer, editing, reorder, duplicate review | Shared frontend | Yes | -| Original PDF page references | Page numbers and links to the currently loaded PDF | Extracted-text lines | -| Export scope | All FAQs or Approved only | All FAQs or Approved only | -| Approval status, search, filters | Shared frontend | Yes | -| Saved projects and optional browser autosave | Yes; schemas 1/2 read, schema 2 saved | Yes | -| Markdown/JSON/HTML export | Browser downloads | Browser downloads | -| PDF/DOCX import and export | Yes; browser PDF.js / Word XML extraction and PDF-LIB / docx exports | Yes; PDFBox / Apache POI | -| OCR, external AI, accounts/billing | No | Not implemented | - -PDF and Word files are processed on the visitor's device. PDF import is limited to 5 MB, 50 pages and 50,000 extracted characters; DOCX import is limited to 5 MB, 50,000 extracted characters, 1,000 archive entries and an 8 MB expanded main XML part. Legacy `.doc`, password-protected PDFs and image-only/scanned PDFs are not supported. Word extraction reads main-document paragraphs and tables, mapping standard Heading 1–6 styles to Markdown section headings (levels 2–6) so the generator treats Heading 1 as a section rather than a document title. Headers/footers, images and complex layouts may not be retained. Browser PDF export **embeds bundled DejaVu Sans regular/bold font subsets** for Turkish, extended Latin, IPA and many mathematical symbols. If a font still cannot display a character, the app recommends Word rather than silently dropping it. Word exports preserve Unicode. Both exports follow **Export scope** and can include extracted-text source references. During review, **View source beside answer** shows links to the original PDF pages in a browser PDF viewer. Saved work keeps page numbers but stores only extracted text, so reopened projects display page numbers without clickable links. - -The demo demonstrates the review workflow; it is not a hosted Java backend and does not claim identical generation results. Its development features may be newer than the latest published JAR. No pasted text is sent to an FAQ server. Optional autosave and downloaded project files contain source text; clear saved data on shared devices. Normal website hosting still serves the page and assets. The document adapter lazily loads version-pinned PDF.js, PDF-LIB, fontkit, JSZip and docx code from jsDelivr. DejaVu fonts are **served by the same website**, not downloaded from a third-party font service. An internet connection is needed on first use; load failures leave the workspace available for retry. See [third-party libraries](../web-demo/THIRD-PARTY.md). +| Paste text or import TXT/Markdown | Drafts in your browser | Drafts on your local Java server | +| Extract existing questions and answers | JavaScript extraction rules | Java extraction service | +| Suggest questions from sections | Markdown heading rules | Java generation service with broader rules | +| Review and edit the draft | Source viewer, editing, reordering, duplicate review, approvals, search, and filters | Same workspace controls | +| Trace a PDF answer | Original PDF page numbers and links while the PDF is loaded | References to extracted-text lines | +| Choose what to export | All FAQs or Approved only | All FAQs or Approved only | +| Save or reopen work | Reads project schemas 1 and 2, saves schema 2, and offers optional browser autosave | Same project formats and autosave option | +| Export Markdown, JSON, or HTML | Browser downloads | Browser downloads | +| Import and export PDF or DOCX | PDF.js and Word XML for import. PDF-LIB and docx for export | PDFBox and Apache POI | +| OCR, external AI, accounts, and billing | Unavailable | Unavailable | + +### PDF and Word in the browser + +I process PDF and Word files on your device. Both formats have a **5 MB** upload limit and a **50,000-character** extracted-text limit. PDFs can have up to **50 pages**. DOCX files can contain up to **1,000 archive entries**, and the main XML part can expand to **8 MB**. Use a text-based, unlocked PDF or a modern `.docx` file. Scanned PDFs need OCR first. + +For Word imports, I read paragraphs and tables from the main document. I map Word’s Heading 1–6 styles to Markdown section headings at levels 2–6, so Heading 1 is treated as a section. Headers, footers, images, and complex layouts may be lost during extraction. + +Browser PDF exports embed regular and bold DejaVu Sans font subsets, which cover Turkish, extended Latin, IPA, and many mathematical symbols. If the PDF font cannot display a character, the demo suggests Word, which preserves Unicode. Both formats follow **Export scope** and can include extracted-text references. + +When reviewing an answer, select **View source beside answer** to open the relevant page of the original PDF while the file is loaded. Saved projects keep extracted text and page numbers. When you reopen a project, the page numbers still appear as labels. + +### Where your document goes + +I built the demo so your document, pasted text, and draft stay in your browser. My site serves the page and bundled DejaVu fonts. Your browser loads version-pinned PDF.js, PDF-LIB, fontkit, JSZip, and docx code from jsDelivr when it needs those libraries. The first load needs an internet connection. If a library fails to load, the workspace stays open so you can retry. See the [third-party library list](../web-demo/THIRD-PARTY.md). + +If you turn on autosave, the browser stores your source text and draft locally. Downloaded project files also contain your source text. On a shared device, use **Clear saved data** when you’re done. ## Build and keep it synchronized -Run from the repository root with Node.js: +I run these commands from the Doc2FAQ repository root with Node.js. ```sh node --test src/test/js/*.test.cjs node scripts/build-website.mjs +node scripts/verify-website-build.mjs ``` -The builder creates ignored `demo-dist/` from the actual app frontend, shared project validator, stylesheet, and background. It replaces backend requests with the browser-only adapter in `web-demo/engine.js`, routes document import and binary export through `web-demo/documents.js`, keeps PDF/Word options available, uses relative asset paths with content-hash cache versions, fills the source-build version, and adds demo disclosure and homepage/source/download links. The approved retro theme also styles the Java application's UI without changing its JavaScript behavior. +The build uses the app’s frontend, project validator, styles, and background to generate `demo-dist/`. It replaces Java requests with the browser adapter in `web-demo/engine.js` and handles document import and binary exports in `web-demo/documents.js`. The demo uses relative asset paths and content hashes so updated assets get new URLs. Its footer version and Java download link come from the Maven project version. The Java app shares the visual theme and keeps its own processing code. -The `build-website.mjs` step then creates ignored `website-dist/` containing the approved **Doc2FAQ marketing homepage** and the working, equally styled `demo/` subdirectory. It rewrites navigation to relative URLs that are valid under `/projects/doc2faq/`. +The final output is `website-dist/`, which includes the project homepage and the `demo/` subdirectory. Both output folders are ignored by Git. The build adjusts internal links for the `/projects/doc2faq/` location on my site. -Copy the complete contents of **`website-dist/`** into `projects/doc2faq/` in the private `OKAN-SOFTWARE/okantiktas.com` repository. Preserve the `demo/` subdirectory and relative filenames. The Doc2FAQ homepage card may link to the new product homepage. Keep `/project/doc2faq/index.html` as a redirect with a visible fallback link. Do not replace the rest of the portfolio or its activity scripts. +To publish, I copy **the contents of `website-dist/`** into `projects/doc2faq/` in my private `OKAN-SOFTWARE/okantiktas.com` repository. I keep the `demo/` folder, preserve the existing `project/doc2faq/index.html` redirect and visible fallback link, and leave the rest of the portfolio and its activity scripts outside this update. The portfolio’s Doc2FAQ card can point to the project homepage. -The portfolio is hosted through its existing GitHub-main → Hostinger deployment. Pushing source and observing a live deployment are separate steps: verify the actual custom-domain route after deployment before reporting it live. Do not deploy the full Java app to static hosting or change DNS to add this subdirectory. +Hostinger picks up changes from the portfolio’s `main` branch. I check the public URLs after the deploy so I know visitors are seeing the new build. This is a static deployment and needs no DNS changes. I distribute the Java app separately through [GitHub Releases](https://github.com/OKAN-SOFTWARE/Doc2FAQ/releases). ## Verify before publishing -- Both homepage routes and the `/projects/doc2faq/demo/` application resolve; source, download and return links work. -- Examples and pasted TXT/Markdown work in both modes; text source references match exactly. -- Source highlights remain stable while typing, including on mobile. -- Approvals persist after save/open and optional autosave/reload; edits/merges reset approval. -- Combine search and status filters, then switch export scope. Verify that previews and downloads use the selected scope and preserve draft order. -- Import real PDF and Word files. Follow an original PDF page link, then export and open PDF and Word downloads. Check page breaks, references, long tokens, Unicode Word text, and PDF glyph errors. -- Invalid, oversized, protected, scanned and excessive-page files are rejected without replacing the current workspace. Clear or edit during processing to confirm late results/downloads are discarded. -- No document content becomes executable HTML; no FAQ requests go to a server. -- Check desktop, narrow-screen controls, keyboard navigation, and reduced-motion behavior. +- Open the project homepage, the older portfolio route, and the live demo. Check the homepage, GitHub, and Java download links. Confirm the demo footer shows the version linked by the download. +- Run the examples and try pasted text and TXT/Markdown imports in both drafting modes. Check that references match the original text and that highlights stay in place while you type, including on mobile. +- Approve an answer, then save and reopen the project. Repeat with autosave and a page reload. Check that editing or merging an approved answer resets its approval. +- Combine search and review filters. Change **Export scope** and check that the preview and downloaded files include the selected FAQs in draft order. +- Open real PDF and Word files. Follow an original PDF page link, then open PDF and Word exports. Check page breaks, source references, long words or URLs, Unicode in Word, and the PDF warning for unsupported characters. +- Try invalid, oversized, protected, scanned, and over-limit PDFs. Failed imports should preserve the open workspace. Clear or edit the source during processing and check that late results and downloads are discarded. +- Verify that document text stays plain text in the rendered UI and that drafting sends no requests to an FAQ server. +- Check the layout on desktop and narrow screens, and test keyboard navigation and reduced motion.