spec-up-t 0.11.35 → 0.11.37

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spec-up-t",
3
- "version": "0.11.35",
3
+ "version": "0.11.37",
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": {
@@ -51,6 +51,7 @@
51
51
  "merge-stream": "2.0.0",
52
52
  "pkg-dir": "4.2.0",
53
53
  "prismjs": ">=1.24.0",
54
+ "puppeteer": "^23.2.1",
54
55
  "readline-sync": "^1.4.10",
55
56
  "yargs": "16.2.0"
56
57
  }
@@ -0,0 +1,39 @@
1
+ const puppeteer = require('puppeteer');
2
+ const path = require('path');
3
+
4
+ (async () => {
5
+ // Launch a new browser instance
6
+ const browser = await puppeteer.launch();
7
+ const page = await browser.newPage();
8
+
9
+ // Define the path to the HTML file based on the directory where the script is called from
10
+ const filePath = path.resolve(process.cwd(), 'docs/index.html');
11
+ const fileUrl = `file://${filePath}`;
12
+
13
+ // Navigate to the HTML file
14
+ await page.goto(fileUrl, { waitUntil: 'networkidle2' });
15
+
16
+ // Remove or hide the search bar or any other element
17
+ await page.evaluate(() => {
18
+ const displayNoneInPdf = document.querySelectorAll('#header span, #container-search-h7vc6omi2hr2880'); // Adjust the selector as needed
19
+ if (displayNoneInPdf) {
20
+ displayNoneInPdf.forEach((element) => {
21
+ element.remove();
22
+ // or
23
+ // element.style.display = 'none';
24
+ });
25
+ }
26
+ });
27
+
28
+ // Generate the PDF
29
+ await page.pdf({
30
+ path: path.resolve(process.cwd(), 'docs/index.pdf'), // Output file path
31
+ format: 'A4', // Paper format
32
+ printBackground: true, // Print background graphics
33
+ displayHeaderFooter: false, // Do not display header and footer
34
+ preferCSSPageSize: true // Use CSS-defined page size
35
+ });
36
+
37
+ // Close the browser instance
38
+ await browser.close();
39
+ })();
@@ -116,7 +116,7 @@ function getXrefsData() {
116
116
  }
117
117
  });
118
118
  } else {
119
- console.error(`File not found: ${outputPathJSON}`);
119
+ console.log(`File not found at this point: ${outputPathJSON}. Don't worry, it will be created later.`);
120
120
  }
121
121
 
122
122
  return commitHash;