Auto-fit Markdown to one A4 page. Binary search optimal font size, render with 10 themes, export PDF+PNG+MD.

Install

openclaw skills install @fxjhello/smartpage

Workflow

When user asks to format/layout a document to one A4 page:

  1. Setup (if repo not present):

    bash
    git clone https://github.com/fxjhello/SmartPage.git
    cd SmartPage
    npm install
    
  2. Convert source (PDF/DOCX/Excel) to Markdown first if needed

  3. Write Markdown to a temp file

  4. Run CLI (default output to user desktop):

    bash
    npm smartpage <file.md> --theme <theme> --output-dir <user-desktop-path>
    
  5. Read output files (PDF/PNG/MD), send to user

  6. After delivery, ALWAYS:

    • Ask: 效果满意吗?如需微调可以帮你打开 Web 编辑器
    • If user wants to tweak, start the dev server and open the browser:
      bash
      cd SmartPage
      npm run dev
      
      Then open http://localhost:5173 in the browser for the user.

CLI Options

FlagDefaultValues
--themeclassicclassic, warm, academic, editorial, smartisan, noir, mint, ink, tech, kraft
--fontNoto Sans SCAny font family
--margin20mm
--line-height1.5ratio
--paragraph-spacing0.5em
--first-line-indent0em
--output-dir(current dir)Path
--output-nameoutputName without extension