spec-up-t 1.6.18 → 1.6.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -74,13 +74,20 @@ body.pdf-document {
74
74
  border-bottom: none !important;
75
75
  }
76
76
 
77
- /* Code blocks */
77
+ /* Code blocks: wrap long lines so they stay within the page.
78
+ overflow: hidden prevents Puppeteer from shrink-to-fitting the whole page.
79
+ word-break: break-all breaks mid-token when a single token exceeds page width.
80
+ Targets both pre and the inner code element (Prism sets white-space:pre on both). */
78
81
  .pdf-document pre,
79
- .pdf-document code {
82
+ .pdf-document pre[class*="language-"],
83
+ .pdf-document pre code,
84
+ .pdf-document pre[class*="language-"] code,
85
+ .pdf-document code[class*="language-"] {
80
86
  white-space: pre-wrap !important;
81
- word-break: break-word !important;
87
+ word-break: break-all !important;
88
+ overflow-wrap: break-word !important;
82
89
  max-width: 100% !important;
83
- overflow: visible !important;
90
+ overflow: hidden !important;
84
91
  }
85
92
 
86
93
  /* Page break control */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-up-t",
3
- "version": "1.6.18",
3
+ "version": "1.6.19",
4
4
  "description": "Technical specification drafting tool that generates rich specification documents from markdown. Forked from https://github.com/decentralized-identity/spec-up by Daniel Buchner (https://github.com/csuwildcat)",
5
5
  "main": "./index",
6
6
  "repository": {
@@ -118,6 +118,20 @@ function processNode(node, elements = []) {
118
118
  }
119
119
  break;
120
120
 
121
+ case 'pre':
122
+ // Treat the entire pre block as a single monospace paragraph.
123
+ // Recursing into children would produce one paragraph per Prism token span.
124
+ if (node.textContent.trim()) {
125
+ elements.push(new Paragraph({
126
+ children: [new TextRun({
127
+ text: node.textContent,
128
+ font: 'Courier New',
129
+ size: 18 // 9pt (half-points)
130
+ })]
131
+ }));
132
+ }
133
+ break;
134
+
121
135
  case 'blockquote':
122
136
  elements.push(new Paragraph({
123
137
  text: node.textContent.trim(),
package/src/create-pdf.js CHANGED
@@ -508,6 +508,20 @@ async function createTOCIfNeeded(page, logo, logoLink, title, description) {
508
508
  }
509
509
  });
510
510
 
511
+ // Force code blocks to wrap so they don't run off the page in the PDF.
512
+ // Must target both <pre> AND its inner <code> because Prism CSS sets
513
+ // white-space:pre on code[class*="language-"] independently.
514
+ // overflow:hidden prevents Puppeteer from shrinking the whole page to fit.
515
+ await page.evaluate(() => {
516
+ document.querySelectorAll('pre, pre > code, code[class*="language-"]').forEach(el => {
517
+ el.style.setProperty('white-space', 'pre-wrap', 'important');
518
+ el.style.setProperty('word-break', 'break-all', 'important');
519
+ el.style.setProperty('overflow-wrap', 'break-word', 'important');
520
+ el.style.setProperty('overflow', 'hidden', 'important');
521
+ el.style.setProperty('max-width', '100%', 'important');
522
+ });
523
+ });
524
+
511
525
  Logger.process('Generating PDF with proper TOC page numbers...');
512
526
 
513
527
  // First, generate a draft PDF to calculate the page positions of each heading
@@ -12,12 +12,7 @@ const Logger = require('../utils/logger');
12
12
  */
13
13
  function copyBoilerplate(template) {
14
14
  const sourceDir = path.join(__dirname, './', 'boilerplate');
15
- // // Use process.cwd() so the destination is always the consuming project root,
16
- // // regardless of whether spec-up-t is installed from npm or via `npm link`.
17
- // // I am not sure if this works in all cases. Needs testing.
18
- // const projectRoot = process.cwd();
19
-
20
- const projectRoot = path.join(__dirname, '../../../../');
15
+ const projectRoot = process.cwd();
21
16
 
22
17
  // Step 1: Copy everything from the default boilerplate
23
18
  const items = fs.readdirSync(sourceDir);
@@ -13,15 +13,7 @@ function copySystemFiles() {
13
13
 
14
14
  systemFiles.forEach(item => {
15
15
  const srcPath = path.join(sourceDir, item);
16
-
17
- // // Use process.cwd() so the destination is always the consuming project root,
18
- // // regardless of whether spec-up-t is installed from npm or via `npm link`.
19
- // // I am not sure if this works in all cases. Needs testing.
20
- // const destPath = path.join(process.cwd(), item);
21
-
22
- // Root of the project
23
- const destPath = path.join(__dirname, '../../../../', item);
24
-
16
+ const destPath = path.join(process.cwd(), item);
25
17
 
26
18
  try {
27
19
  fs.cpSync(srcPath, destPath, { recursive: true });
@@ -122,7 +122,7 @@ function migrateVersionsToSnapshots(outputPath) {
122
122
  'Configure GitHub Pages deployment',
123
123
  {
124
124
  hint: 'Update your repository settings to deploy from gh-pages branch',
125
- steps: [
125
+ details: [
126
126
  'Go to your repository on GitHub',
127
127
  'Click Settings',
128
128
  'In the left sidebar, click Pages',
@@ -308,14 +308,6 @@ function collectExternalReferences(options = {}) {
308
308
  const { externalSpecsRepos, hasExternalSpecsField } = normalizedConfig;
309
309
  const GITHUB_API_TOKEN = options.pat || process.env.GITHUB_API_TOKEN;
310
310
 
311
- if (!GITHUB_API_TOKEN) {
312
- Logger.warn('No GitHub Personal Access Token (PAT) found. Running without authentication', {
313
- context: 'GitHub API requests will use unauthenticated access',
314
- hint: 'Set GITHUB_PAT environment variable to increase rate limit from 60 to 5000 requests/hour. See: https://trustoverip.github.io/spec-up-t-website/docs/getting-started/github-token',
315
- details: 'You may hit rate limits when fetching many external references'
316
- });
317
- }
318
-
319
311
  // Communicate that the expected external_specs array is missing entirely.
320
312
  if (!hasExternalSpecsField) {
321
313
  Logger.info(