From 8c754069bfe32053dc569c3efc94c3db18c122ce Mon Sep 17 00:00:00 2001 From: SheetJS Date: Sun, 7 May 2023 09:58:36 -0400 Subject: [PATCH] eleventy --- .spelling | 6 + .../01-installation/01-standalone.mdx | 45 ++--- .../01-installation/02-frameworks.md | 28 +-- .../01-installation/03-nodejs.md | 49 +++-- .../01-installation/04-amd.md | 2 +- .../01-installation/05-extendscript.md | 2 +- .../01-installation/06-deno.md | 17 +- .../01-installation/07-bun.md | 6 +- docz/docs/02-getting-started/02-example.mdx | 177 ++++++++++++------ docz/docs/03-demos/01-frontend/01-react.md | 13 +- docz/docs/03-demos/01-frontend/02-vue.md | 13 +- docz/docs/03-demos/01-frontend/03-angular.md | 17 +- docz/docs/03-demos/01-frontend/04-svelte.md | 13 +- docz/docs/03-demos/01-frontend/08-bundler.md | 154 +++++++-------- docz/docs/03-demos/04-static/02-gatsbyjs.md | 13 +- docz/docs/03-demos/04-static/05-vitejs.md | 2 +- docz/docs/03-demos/04-static/07-eleventy.md | 166 ++++++++++++++++ docz/docs/03-demos/04-static/11-svelte.md | 7 +- .../04-static/{10-astro.md => 12-astro.md} | 5 +- .../03-demos/05-mobile/02-nativescript.md | 5 +- docz/docs/03-demos/05-mobile/03-quasar.md | 5 +- docz/docs/03-demos/05-mobile/04-ionic.md | 8 +- docz/docs/03-demos/05-mobile/05-capacitor.md | 5 +- docz/docs/03-demos/06-desktop/01-electron.md | 2 +- docz/docs/03-demos/06-desktop/02-nwjs.md | 2 +- .../03-demos/06-desktop/06-reactnative.md | 9 +- docz/docs/03-demos/06-desktop/09-cli.md | 15 +- docz/docs/03-demos/07-data/09-alasql.md | 16 +- docz/docs/03-demos/07-data/14-knex.md | 5 +- docz/docs/03-demos/07-data/26-redis.md | 5 +- docz/docs/03-demos/09-cloud/02-aws.md | 7 +- docz/docs/03-demos/09-cloud/08-airtable.md | 5 +- docz/docs/03-demos/09-cloud/index.md | 2 +- .../03-demos/10-extensions/03-excelapi.md | 7 +- docz/docs/03-demos/10-extensions/04-gsheet.md | 4 +- docz/docs/03-demos/10-extensions/05-osa.md | 5 +- .../03-demos/10-extensions/06-mathematica.md | 5 +- docz/docs/03-demos/12-engines/01_duktape.md | 5 +- docz/docs/03-demos/12-engines/02_jsc.md | 5 +- docz/docs/03-demos/12-engines/03_rhino.md | 5 +- docz/docs/03-demos/12-engines/04_nashorn.md | 5 +- docz/docs/03-demos/12-engines/05_goja.md | 5 +- docz/docs/03-demos/12-engines/07_chakra.md | 5 +- docz/docs/03-demos/12-engines/08_quickjs.md | 9 +- docz/docs/03-demos/12-engines/09_rb.md | 5 +- docz/docs/03-demos/12-engines/11_perl.md | 5 +- docz/docs/03-demos/index.md | 1 + docz/docs/06-solutions/01-input.md | 40 ++-- docz/docs/06-solutions/05-output.md | 12 +- docz/docs/08-api/07-write-options.md | 23 +-- docz/docs/09-miscellany/02-errors.md | 9 +- docz/docs/09-miscellany/05-contributing.md | 2 +- docz/docs/index.md | 9 +- docz/docusaurus.config.js | 2 +- docz/src/theme/prism-include-languages.js | 25 +++ docz/static/eleventy/_eleventy.js | 21 +++ docz/static/eleventy/index.njk | 10 + 57 files changed, 685 insertions(+), 365 deletions(-) create mode 100644 docz/docs/03-demos/04-static/07-eleventy.md rename docz/docs/03-demos/04-static/{10-astro.md => 12-astro.md} (98%) create mode 100644 docz/src/theme/prism-include-languages.js create mode 100644 docz/static/eleventy/_eleventy.js create mode 100644 docz/static/eleventy/index.njk diff --git a/.spelling b/.spelling index 57fe27a..1882c3e 100644 --- a/.spelling +++ b/.spelling @@ -8,6 +8,7 @@ pagination_prev pagination_next TabItem DocCardList +CodeBlock # frontmatter noise api @@ -158,8 +159,10 @@ ES5 ES6 ESM ETH +Eleventy Endian Ethercalc +ExecJS ExpressJS ExtendScript Fastify @@ -168,6 +171,7 @@ FileReaderSync FileSaver GBK GatsbyJS +GitHub GitLab Goja GraphQL @@ -239,6 +243,7 @@ R9 RDBMS README RESTlets +RSS ReactJS Redis RequireJS @@ -259,6 +264,7 @@ Snowpack SuiteScript SuiteScripts Suitelets +SvelteKit SystemJS Tauri TensorFlow diff --git a/docz/docs/02-getting-started/01-installation/01-standalone.mdx b/docz/docs/02-getting-started/01-installation/01-standalone.mdx index 45e30ff..3195f50 100644 --- a/docz/docs/02-getting-started/01-installation/01-standalone.mdx +++ b/docz/docs/02-getting-started/01-installation/01-standalone.mdx @@ -7,17 +7,18 @@ sidebar_custom_props: --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; # Standalone Browser Scripts Each standalone release script is available at . -
The current version is {current} and can be referenced as follows:
+

The current version is {current} and can be referenced as follows:

-
{`\
+{`\
 
 `}
-
+ :::info @@ -43,10 +44,10 @@ They are known CDN bugs. `xlsx.full.min.js` is the complete standalone script. It includes support for reading and writing many spreadsheet formats. -
{`\
+{`\
 
 `}
-
+ A slimmer build is generated at `dist/xlsx.mini.min.js`. Compared to full build: @@ -59,10 +60,10 @@ A slimmer build is generated at `dist/xlsx.mini.min.js`. Compared to full build: Replace references to `xlsx.full.min.js` with `xlsx.mini.min.js`. Starting from scratch, a single script tag should be added at the top of the HTML page: -
{`\
+{`\
 
 `}
-
+ @@ -72,16 +73,16 @@ For broad compatibility with JavaScript engines, the library is written using ECMAScript 3 language dialect. A "shim" script provides implementations of functions for older browsers and environments. -
Due to SSL compatibility issues, older versions of IE will not be able to +Due to SSL compatibility issues, older versions of IE will not be able to use the CDN scripts directly. They should be downloaded and saved to a public directory in the site: + -
-Add a `script` reference to the shim before the script tag that loads `xlsx.js`: +Add a `script` reference to the shim before the standalone script: ```html @@ -95,10 +96,10 @@ Add a `script` reference to the shim before the script tag that loads `xlsx.js`: The standalone scripts can be loaded using `importScripts` at the top of the worker scripts: -
{`\
+{`\
 importScripts("https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js");
 importScripts("https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js");`}
-
+ ## ECMAScript Module Imports @@ -114,42 +115,42 @@ described [in the next section](/docs/getting-started/installation/frameworks). The ECMAScript Module build is saved to `xlsx.mjs` and can be directly added to a page with a `script` tag using `type="module"`: -
{`\
+{`\
 `}
-
+ If Encoding support is required, `cpexcel.full.mjs` must be manually imported: -
{`\
+{`\
 `}
-
+ Dynamic imports with `import()` can be used in data export scenarios. This example will download the library only when the export button is pressed: -
{`\
+{`\
 
 `}
-
+ Web Worker support is noted in [the demo](/docs/demos/bigdata/worker#installation) @@ -164,8 +165,8 @@ Bower is deprecated and the maintainers recommend using other tools. The Bower package manager plays nice with the CDN tarballs: -
{`\
+{`\
 npx bower install https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+ Bower will place the standalone scripts in `bower_components/js-xlsx/dist/` diff --git a/docz/docs/02-getting-started/01-installation/02-frameworks.md b/docz/docs/02-getting-started/01-installation/02-frameworks.md index fdd1437..3582658 100644 --- a/docz/docs/02-getting-started/01-installation/02-frameworks.md +++ b/docz/docs/02-getting-started/01-installation/02-frameworks.md @@ -18,21 +18,21 @@ Each standalone release package is available at . The NodeJS package is designed to be used with frameworks and bundlers. It is a proper ECMAScript Module release which can be optimized with developer tools. - + -
{`\
+{`\
 npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
-
{`\
+{`\
 pnpm install https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
-
{`\
+{`\
 yarn add https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
@@ -64,24 +64,24 @@ This is a known registry bug For existing projects, the easiest approach is to uninstall and reinstall: - + -
{`\
+{`\
 npm rm --save xlsx
 npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
-
{`\
+{`\
 pnpm rm xlsx
 pnpm install https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
-
{`\
+{`\
 yarn remove xlsx
 yarn add https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
diff --git a/docz/docs/02-getting-started/01-installation/03-nodejs.md b/docz/docs/02-getting-started/01-installation/03-nodejs.md index bc86c32..389e081 100644 --- a/docz/docs/02-getting-started/01-installation/03-nodejs.md +++ b/docz/docs/02-getting-started/01-installation/03-nodejs.md @@ -16,28 +16,27 @@ import TabItem from '@theme/TabItem'; Tarballs are available on . -
Each individual version can be referenced using a similar URL pattern.
-https://cdn.sheetjs.com/xlsx-{current}/xlsx-{current}.tgz is the URL for {current}
+

https://cdn.sheetjs.com/xlsx-{current}/xlsx-{current}.tgz is the URL for version {current}

## Installation Tarballs can be directly installed using a package manager: - + -
{`\
+{`\
 npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
-
{`\
+{`\
 pnpm install https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
-
{`\
+{`\
 yarn add https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
@@ -60,24 +59,24 @@ This is a known registry bug For existing projects, the easiest approach is to uninstall and reinstall: - + -
{`\
+{`\
 npm rm --save xlsx
 npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
-
{`\
+{`\
 pnpm rm xlsx
 pnpm install https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
-
{`\
+{`\
 yarn remove xlsx
 yarn add https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+
@@ -100,29 +99,29 @@ in `package.json` can control module resolution: For general stability, "vendoring" modules is the recommended approach: -
1) Download the tarball (xlsx-{current}.tgz) for the desired version. The current - version is available at https://cdn.sheetjs.com/xlsx-{current}/xlsx-{current}.tgz

+

1) Download the tarball (xlsx-{current}.tgz) for the desired version. The current + version is available at https://cdn.sheetjs.com/xlsx-{current}/xlsx-{current}.tgz

2) Create a `vendor` subfolder at the root of your project and move the tarball to that folder. Add it to your project repository. 3) Install the tarball using a package manager: - + -
{`\
+{`\
 npm i --save file:vendor/xlsx-${current}.tgz`}
-
+
-
{`\
+{`\
 pnpm install file:vendor/xlsx-${current}.tgz`}
-
+
-
{`\
+{`\
 yarn add  file:vendor/xlsx-${current}.tgz`}
-
+
diff --git a/docz/docs/02-getting-started/01-installation/04-amd.md b/docz/docs/02-getting-started/01-installation/04-amd.md index e714e09..5bc9d54 100644 --- a/docz/docs/02-getting-started/01-installation/04-amd.md +++ b/docz/docs/02-getting-started/01-installation/04-amd.md @@ -15,7 +15,7 @@ Each standalone release script is available at . `xlsx.full.min.js` supports AMD with name `xlsx` out of the box. -
+

https://cdn.sheetjs.com/xlsx-{current}/package/dist/xlsx.full.min.js is the URL for {current}

:::note diff --git a/docz/docs/02-getting-started/01-installation/05-extendscript.md b/docz/docs/02-getting-started/01-installation/05-extendscript.md index 8d397b1..3ba5c49 100644 --- a/docz/docs/02-getting-started/01-installation/05-extendscript.md +++ b/docz/docs/02-getting-started/01-installation/05-extendscript.md @@ -14,7 +14,7 @@ Each standalone release script is available at . `xlsx.extendscript.js` is an ExtendScript build for Photoshop and InDesign. -
+

https://cdn.sheetjs.com/xlsx-{current}/package/dist/xlsx.extendscript.js is the URL for {current}

After downloading the script, it can be directly referenced with `#include`: diff --git a/docz/docs/02-getting-started/01-installation/06-deno.md b/docz/docs/02-getting-started/01-installation/06-deno.md index 2db7ea9..d9f68a7 100644 --- a/docz/docs/02-getting-started/01-installation/06-deno.md +++ b/docz/docs/02-getting-started/01-installation/06-deno.md @@ -9,6 +9,7 @@ sidebar_custom_props: import current from '/version.js'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; # Deno @@ -16,10 +17,10 @@ Module scripts and type definitions are available at . Using the URL imports, `deno run` will automatically download scripts and types: -
{`\
+{`\
 // @deno-types="https://cdn.sheetjs.com/xlsx-${current}/package/types/index.d.ts"
 import * as XLSX from 'https://cdn.sheetjs.com/xlsx-${current}/package/xlsx.mjs';`}
-
+ The `@deno-types` comment instructs Deno to use the type definitions. @@ -42,28 +43,28 @@ new versions are released! If Encoding support is required, `cpexcel.full.mjs` must be manually imported: -
{`\
+{`\
 /* load the codepage support library for extended support with older formats  */
 import * as cptable from 'https://cdn.sheetjs.com/xlsx-${current}/package/dist/cpexcel.full.mjs';
 XLSX.set_cptable(cptable);`}
-
+ ## Upgrade Notes Upgrading to the latest version involves changing the import URLs. The import and the types URLs should be updated at the same time: -
{`\
+{`\
 -// @deno-types="https://cdn.sheetjs.com/xlsx-0.18.3/package/types/index.d.ts"
 +// @deno-types="https://cdn.sheetjs.com/xlsx-${current}/package/types/index.d.ts"
-
+\n\
 -import * as XLSX from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/xlsx.mjs';
 +import * as XLSX from 'https://cdn.sheetjs.com/xlsx-${current}/package/xlsx.mjs';
-
+\n\
 -import * as cptable from 'https://cdn.sheetjs.com/xlsx-0.18.3/package/dist/cpexcel.full.mjs';
 +import * as cptable from 'https://cdn.sheetjs.com/xlsx-${current}/package/dist/cpexcel.full.mjs';
 `}
-
+ #### Deno Registry diff --git a/docz/docs/02-getting-started/01-installation/07-bun.md b/docz/docs/02-getting-started/01-installation/07-bun.md index 46fba58..0122d6b 100644 --- a/docz/docs/02-getting-started/01-installation/07-bun.md +++ b/docz/docs/02-getting-started/01-installation/07-bun.md @@ -10,9 +10,9 @@ import current from '/version.js'; # Bun -Each standalone release script is available at . +Module scripts are available at . -
+

https://cdn.sheetjs.com/xlsx-{current}/package/xlsx.mjs is the URL for {current}

After downloading the script, it can be directly imported: @@ -41,7 +41,7 @@ new versions are released! If Encoding support is required, `cpexcel.full.mjs` must be manually imported. -
+

https://cdn.sheetjs.com/xlsx-{current}/package/dist/cpexcel.full.mjs is the URL for {current}

```ts diff --git a/docz/docs/02-getting-started/02-example.mdx b/docz/docs/02-getting-started/02-example.mdx index 745469d..0df6cb4 100644 --- a/docz/docs/02-getting-started/02-example.mdx +++ b/docz/docs/02-getting-started/02-example.mdx @@ -192,34 +192,24 @@ worksheet["!cols"] = [ { wch: max_width } ]; +After cleanup, the generated workbook looks like the screenshot below: + +![Final export](pathname:///example/final.png) + ## Export a File `XLSX.writeFile` creates a spreadsheet file and tries to write it to the system. In the browser, it will try to prompt the user to download the file. In NodeJS, it will write to the local directory. -:::note - -`XLSX.writeFileXLSX` only writes XLSX files and is recommended when the export -will always be in the `.xlsx` format. `writeFileXLSX` is more amenable to tree -shaking. This example uses `XLSX.writeFile` since `writeFileXLSX` does not -support other common export formats like `.xls` or `.xlsb` or `.csv`. - -`compression: true` enables ZIP compression for XLSX and other formats. - -::: - ```js XLSX.writeFile(workbook, "Presidents.xlsx", { compression: true }); ``` -![Final export](pathname:///example/final.png) - - ## Live Demo This demo runs in the web browser! Click "Click to Generate File!" and the -browser should generate a XLSX file. +browser should try to create `Presidents.xlsx` ```jsx live function Presidents() { return ( ); } ``` + is a hosted version of this demo. + ## Run the Demo Locally -Save the following script to `snippet.html` and open the page. The page must be -hosted (no `file:///` access). +Save the following script to `SheetJSStandaloneDemo.html`: - is a hosted version of the page. - -{`\ +{`\ `} - + #### Frameworks and Bundlers `alasql` uses an older version of the library. It can be overridden through a `package.json` override. The lines should be added *before* installing `alasql`: -
{`\
+{`\
 {
   /* add this part before "name" */
   /* highlight-start */
@@ -121,12 +121,12 @@ be loaded before the `alasql` script:
   "name": "my-project",
   /* ... more fields ... */
 `}
-
+
After adding the override, AlaSQL can be installed through `npm`: ```bash -npm install --save alasql +npm i --save alasql ``` In imports, the SheetJS library must be passed to AlaSQL as shown below: @@ -200,13 +200,13 @@ const { promise: alasql } = require("alasql"); `alasql` uses an older version of the library. It can be overridden through a `package.json` override in the latest versions of NodeJS: -
{`\
+{`\
 {
   "overrides": {
     "xlsx": "https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz"
   }
 }`}
-
+ ::: @@ -314,7 +314,7 @@ node SheetJSAlaSQL.js The output should display: -``` +```js [ { Name: 'Bill Clinton', Index: 42 }, { Name: 'GeorgeW Bush', Index: 43 }, diff --git a/docz/docs/03-demos/07-data/14-knex.md b/docz/docs/03-demos/07-data/14-knex.md index 72cdba6..9e5af6d 100644 --- a/docz/docs/03-demos/07-data/14-knex.md +++ b/docz/docs/03-demos/07-data/14-knex.md @@ -7,6 +7,7 @@ sidebar_custom_props: --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; :::note @@ -39,9 +40,9 @@ const worksheet = XLSX.utils.json_to_sheet(aoo); 1) Install dependencies: -
{`\
+{`\
 npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz knex better-sqlite3`}
-
+ 2) Download the [test file](https://sheetjs.com/pres.numbers) diff --git a/docz/docs/03-demos/07-data/26-redis.md b/docz/docs/03-demos/07-data/26-redis.md index d718ee0..71a49d1 100644 --- a/docz/docs/03-demos/07-data/26-redis.md +++ b/docz/docs/03-demos/07-data/26-redis.md @@ -7,6 +7,7 @@ sidebar_custom_props: --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; Redis has 5 core data types: "String", List", "Set", "Sorted Set", and "Hash". Since the keys and values are limited to simple strings (and numbers), it is @@ -203,10 +204,10 @@ curl -LO https://docs.sheetjs.com/nosql/SheetJSRedisTest.mjs 2) Install dependencies and run: -
{`\
+{`\
 npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz redis@4.6.4
 node SheetJSRedisTest.mjs`}
-
+ Inspect the output and compare with the data in `SheetJSRedisTest.mjs`. diff --git a/docz/docs/03-demos/09-cloud/02-aws.md b/docz/docs/03-demos/09-cloud/02-aws.md index 9dc2e65..faecfb9 100644 --- a/docz/docs/03-demos/09-cloud/02-aws.md +++ b/docz/docs/03-demos/09-cloud/02-aws.md @@ -5,6 +5,7 @@ pagination_next: demos/extensions/index --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; AWS is a Cloud Services platform which includes traditional virtual machine support, "Serverless Functions", cloud storage and much more. @@ -138,10 +139,10 @@ curl -LO https://docs.sheetjs.com/aws/index.js 2) Install dependencies in the project directory; -
{`\
+{`\
 mkdir -p node_modules
-npm install https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz busboy`}
-
+npm i https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz busboy`} + 3) Create a .zip package of the contents of the folder: diff --git a/docz/docs/03-demos/09-cloud/08-airtable.md b/docz/docs/03-demos/09-cloud/08-airtable.md index 11594d6..0f4f11e 100644 --- a/docz/docs/03-demos/09-cloud/08-airtable.md +++ b/docz/docs/03-demos/09-cloud/08-airtable.md @@ -5,6 +5,7 @@ pagination_next: demos/extensions/index --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; Airtable recommends Personal Access Tokens for interacting with their API. When fetching data from the API, the result will include an array of row objects that @@ -15,9 +16,9 @@ to write data will accept row objects generated by `XLSX.utils.sheet_to_json`. The main module is `airtable` and can be installed with `npm`: -
{`\
+{`\
 npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz airtable`}
-
+ To obtain a reference to a table, code needs a [PAT](#personal-access-token), the name of the workspace (typically starting with `app`), and the name of the diff --git a/docz/docs/03-demos/09-cloud/index.md b/docz/docs/03-demos/09-cloud/index.md index 3bbfe8e..46b24c8 100644 --- a/docz/docs/03-demos/09-cloud/index.md +++ b/docz/docs/03-demos/09-cloud/index.md @@ -44,7 +44,7 @@ File hosting services provide simple solutions for storing data, synchronizing files across devices, and sharing with specific users or customers. Demos: - [Dropbox](/docs/demos/cloud/dropbox) -- [Github](/docs/demos/cloud/github) +- [GitHub](/docs/demos/cloud/github) ## Cloud Data diff --git a/docz/docs/03-demos/10-extensions/03-excelapi.md b/docz/docs/03-demos/10-extensions/03-excelapi.md index 9da223d..fc1f053 100644 --- a/docz/docs/03-demos/10-extensions/03-excelapi.md +++ b/docz/docs/03-demos/10-extensions/03-excelapi.md @@ -5,6 +5,7 @@ pagination_next: demos/bigdata/index --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; :::info @@ -93,7 +94,7 @@ async function extern(url) { 2) Install dependencies in a new PowerShell window: ```powershell -npm install -g yo bower generator-office +npm i -g yo bower generator-office ``` ### Creating a new Add-in @@ -134,9 +135,9 @@ element with name `bt:String`. Change the `DefaultValue` attribute to `SHEETJS`: 7) Install the SheetJS library in the project -
{`\
+{`\
 npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
-
+ 8) Replace `src\functions\functions.js` with the following: diff --git a/docz/docs/03-demos/10-extensions/04-gsheet.md b/docz/docs/03-demos/10-extensions/04-gsheet.md index 99c5cdf..1adf10b 100644 --- a/docz/docs/03-demos/10-extensions/04-gsheet.md +++ b/docz/docs/03-demos/10-extensions/04-gsheet.md @@ -140,9 +140,9 @@ and paste in the terminal. Press Enter after pasting the ID. 7) Download the standalone build and move to the project directory: -
{`\
+{`\
 curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}
-
+ 8) Push the project to Apps Script: diff --git a/docz/docs/03-demos/10-extensions/05-osa.md b/docz/docs/03-demos/10-extensions/05-osa.md index d20f7a5..2f792ad 100644 --- a/docz/docs/03-demos/10-extensions/05-osa.md +++ b/docz/docs/03-demos/10-extensions/05-osa.md @@ -7,6 +7,7 @@ pagination_next: demos/bigdata/index import current from '/version.js'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; Open Scripting Architecture (OSA), a built-in feature in macOS introduced in 1993, enables users to communicate with applications with a standardized @@ -145,10 +146,10 @@ data in CSV format. 0) Download the standalone script and test file: -
{`\
+{`\
 curl -LO https://sheetjs.com/pres.numbers
 curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}
-
+ diff --git a/docz/docs/03-demos/10-extensions/06-mathematica.md b/docz/docs/03-demos/10-extensions/06-mathematica.md index 5c59024..f2e00c2 100644 --- a/docz/docs/03-demos/10-extensions/06-mathematica.md +++ b/docz/docs/03-demos/10-extensions/06-mathematica.md @@ -5,6 +5,7 @@ pagination_next: demos/bigdata/index --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; :::note @@ -56,12 +57,12 @@ This demo was tested in macOS. The path names will differ in other platforms. 1) Create the standalone `xlsx-cli` binary: -
{`\
+{`\
 cd /tmp
 npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz exit-on-epipe commander@2
 curl -LO https://docs.sheetjs.com/cli/xlsx-cli.js
 npx nexe -t 14.15.3 xlsx-cli.js`}
-
+ This is discussed in ["Command-line Tools"](/docs/demos/desktop/cli) diff --git a/docz/docs/03-demos/12-engines/01_duktape.md b/docz/docs/03-demos/12-engines/01_duktape.md index 488abac..384c7e6 100644 --- a/docz/docs/03-demos/12-engines/01_duktape.md +++ b/docz/docs/03-demos/12-engines/01_duktape.md @@ -5,6 +5,7 @@ pagination_next: solutions/input --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; Duktape is an embeddable JS engine written in C. It has been ported to a number of exotic architectures and operating systems. @@ -139,11 +140,11 @@ mv duktape-2.7.0/src/*.{c,h} .
  • pres.numbers
  • -
    {`\
    +{`\
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
     curl -LO https://sheetjs.com/pres.numbers`}
    -
    + 2) Download [`sheetjs.duk.c`](pathname:///duk/sheetjs.duk.c): diff --git a/docz/docs/03-demos/12-engines/02_jsc.md b/docz/docs/03-demos/12-engines/02_jsc.md index 9142965..fefb8cb 100644 --- a/docz/docs/03-demos/12-engines/02_jsc.md +++ b/docz/docs/03-demos/12-engines/02_jsc.md @@ -5,6 +5,7 @@ pagination_next: solutions/input --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; iOS and MacOS ship with the JavaScriptCore framework for running JS code from Swift and Objective-C. Hybrid function invocation is tricky, but explicit data @@ -133,10 +134,10 @@ cd sheetjswift
  • pres.numbers
  • -
    {`\
    +{`\
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
     curl -LO https://sheetjs.com/pres.numbers`}
    -
    + 2) Download the Swift scripts for the demo diff --git a/docz/docs/03-demos/12-engines/03_rhino.md b/docz/docs/03-demos/12-engines/03_rhino.md index 6b9f19f..1003726 100644 --- a/docz/docs/03-demos/12-engines/03_rhino.md +++ b/docz/docs/03-demos/12-engines/03_rhino.md @@ -5,6 +5,7 @@ pagination_next: solutions/input --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; Rhino is an ES3+ engine in Java. @@ -140,10 +141,10 @@ curl -L -o rhino.jar https://github.com/mozilla/rhino/releases/download/Rhino1_7
  • pres.xlsx
  • -
    {`\
    +{`\
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
     curl -LO https://sheetjs.com/pres.xlsx`}
    -
    + 2) Download [`SheetJSRhino.zip`](pathname:///rhino/SheetJSRhino.zip) and unzip diff --git a/docz/docs/03-demos/12-engines/04_nashorn.md b/docz/docs/03-demos/12-engines/04_nashorn.md index d9ddca2..b0f7380 100644 --- a/docz/docs/03-demos/12-engines/04_nashorn.md +++ b/docz/docs/03-demos/12-engines/04_nashorn.md @@ -7,6 +7,7 @@ pagination_next: solutions/input import current from '/version.js'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; Nashorn is a JavaScript engine for Java. It shipped with Java distributions starting with Java 8 and was eventually removed in Java 15. The project was @@ -128,11 +129,11 @@ curl -LO "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm-util/9
  • pres.xlsx
  • -
    {`\
    +{`\
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js
     curl -LO https://sheetjs.com/pres.xlsx`}
    -
    + 2) Download [`SheetJSNashorn.java`](pathname:///nashorn/SheetJSNashorn.java): diff --git a/docz/docs/03-demos/12-engines/05_goja.md b/docz/docs/03-demos/12-engines/05_goja.md index 406124d..723acb5 100644 --- a/docz/docs/03-demos/12-engines/05_goja.md +++ b/docz/docs/03-demos/12-engines/05_goja.md @@ -5,6 +5,7 @@ pagination_next: solutions/input --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; Goja is a pure Go implementation of ECMAScript 5. @@ -110,11 +111,11 @@ go get github.com/dop251/goja
  • pres.numbers
  • -
    {`\
    +{`\
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
     curl -LO https://sheetjs.com/pres.numbers`}
    -
    + 2) Download [`SheetGoja.go`](pathname:///goja/SheetGoja.go): diff --git a/docz/docs/03-demos/12-engines/07_chakra.md b/docz/docs/03-demos/12-engines/07_chakra.md index ebb4b4b..d304e41 100644 --- a/docz/docs/03-demos/12-engines/07_chakra.md +++ b/docz/docs/03-demos/12-engines/07_chakra.md @@ -5,6 +5,7 @@ pagination_next: solutions/input --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; ChakraCore is an embeddable JS engine written in C++. @@ -159,11 +160,11 @@ This program tries to parse the file specified by the first argument
  • pres.numbers
  • -
    {`\
    +{`\
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js
     curl -LO https://sheetjs.com/pres.numbers`}
    -
    + 5) Run the test program: diff --git a/docz/docs/03-demos/12-engines/08_quickjs.md b/docz/docs/03-demos/12-engines/08_quickjs.md index 3430d84..868591b 100644 --- a/docz/docs/03-demos/12-engines/08_quickjs.md +++ b/docz/docs/03-demos/12-engines/08_quickjs.md @@ -5,6 +5,7 @@ pagination_next: solutions/input --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; QuickJS is an embeddable JS engine written in C. It provides a separate set of functions for interacting with the filesystem and the global object. It can run @@ -163,10 +164,10 @@ This program tries to parse the file specified by the first argument
  • pres.numbers
  • -
    {`\
    +{`\
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
     curl -LO https://sheetjs.com/pres.numbers`}
    -
    + 5) Run the test program: @@ -195,10 +196,10 @@ This demo was last tested on 2023 March 11 against QuickJS `2021-03-27`.
  • pres.numbers
  • -
    {`\
    +{`\
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
     curl -LO https://sheetjs.com/pres.numbers`}
    -
    + 2) Download [`SheetJSQuick.js`](pathname:///quickjs/SheetJSQuick.js) diff --git a/docz/docs/03-demos/12-engines/09_rb.md b/docz/docs/03-demos/12-engines/09_rb.md index 180cff0..a9cea1e 100644 --- a/docz/docs/03-demos/12-engines/09_rb.md +++ b/docz/docs/03-demos/12-engines/09_rb.md @@ -5,6 +5,7 @@ pagination_next: solutions/input --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; ExecJS is a Ruby abstraction over a number of JS runtimes including V8. @@ -81,10 +82,10 @@ gem install execjs
  • pres.numbers
  • -
    {`\
    +{`\
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
     curl -LO https://sheetjs.com/pres.numbers`}
    -
    + 2) Download [`ExecSheetJS.rb`](pathname:///execjs/ExecSheetJS.rb): diff --git a/docz/docs/03-demos/12-engines/11_perl.md b/docz/docs/03-demos/12-engines/11_perl.md index ff8bf4e..b95b855 100644 --- a/docz/docs/03-demos/12-engines/11_perl.md +++ b/docz/docs/03-demos/12-engines/11_perl.md @@ -5,6 +5,7 @@ pagination_next: solutions/input --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; :::warning @@ -113,9 +114,9 @@ cpan install JE 2) Download the [ExtendScript build](/docs/getting-started/installation/extendscript): -
    {`\
    +{`\
     curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.extendscript.js`}
    -
    + 3) Download the demo [`SheetJE.pl`](pathname:///perl/SheetJE.pl): diff --git a/docz/docs/03-demos/index.md b/docz/docs/03-demos/index.md index 9179384..54f0cf0 100644 --- a/docz/docs/03-demos/index.md +++ b/docz/docs/03-demos/index.md @@ -61,6 +61,7 @@ run in the web browser, demos will include interactive examples. - [`Lume`](/docs/demos/static/lume) - [`GatsbyJS`](/docs/demos/static/gatsbyjs) +- [`Eleventy`](/docs/demos/static/eleventy) - [`ViteJS`](/docs/demos/static/vitejs) - [`NextJS`](/docs/demos/static/nextjs) - [`NuxtJS`](/docs/demos/static/nuxtjs) diff --git a/docz/docs/06-solutions/01-input.md b/docz/docs/06-solutions/01-input.md index e125ae4..e170852 100644 --- a/docz/docs/06-solutions/01-input.md +++ b/docz/docs/06-solutions/01-input.md @@ -130,11 +130,11 @@ The [`extendscript` demo](/docs/demos/extendscript) includes a more complex exam `readFile` uses `Deno.readFileSync` under the hood: -
    {`\
    +{`\
     // @deno-types="https://cdn.sheetjs.com/xlsx-${current}/package/types/index.d.ts"
     import * as XLSX from 'https://cdn.sheetjs.com/xlsx-${current}/package/xlsx.mjs';
    -
    -const workbook = XLSX.readFile("test.xlsx");`}
    +\n\ +const workbook = XLSX.readFile("test.xlsx");`} :::note @@ -330,18 +330,18 @@ The [`server` demo](/docs/demos/server) has more advanced examples. Drash is a HTTP server framework for Deno. In a `POST` request handler, the body parser can pull file data into a `Uint8Array`: -
    {`\
    +{`\
     // @deno-types="https://cdn.sheetjs.com/xlsx-${current}/package/types/index.d.ts"
     import * as XLSX from 'https://cdn.sheetjs.com/xlsx-${current}/package/xlsx.mjs';
     /* load the codepage support library for extended support with older formats  */
     import * as cptable from 'https://cdn.sheetjs.com/xlsx-${current}/package/dist/cpexcel.full.mjs';
     XLSX.set_cptable(cptable);
    -
    +\n\
     import * as Drash from "https://deno.land/x/drash@v2.5.4/mod.ts";
    -
    +\n\
     class SheetResource extends Drash.Resource {
       public paths = ["/"];
    -
    +\n\
       public POST(request: Drash.Request, response: Drash.Response) {
         // highlight-next-line
         const file = request.bodyParam("file");
    @@ -352,15 +352,15 @@ class SheetResource extends Drash.Resource {
         return response.html(html);
       }
     }
    -
    +\n\
     const server = new Drash.Server({ hostname: "", port: 7262, protocol: "http",
       resources: [
         // highlight-next-line
         SheetResource,
       ],
     });
    -
    -server.run();`}
    +\n\ +server.run();`} :::note @@ -432,7 +432,7 @@ The [`xhr` demo](/docs/demos/network) includes a longer discussion and more exam
    -Node 17.5 and 18.0 have native support for fetch: +NodeJS releases starting from version 18.0 have native support for fetch: ```js const XLSX = require("xlsx"); @@ -498,18 +498,18 @@ const workbook = XLSX.read(data); Deno has native support for `fetch`. -
    {`\
    +{`\
     // @deno-types="https://cdn.sheetjs.com/xlsx-${current}/package/types/index.d.ts"
     import * as XLSX from 'https://cdn.sheetjs.com/xlsx-${current}/package/xlsx.mjs';
     /* load the codepage support library for extended support with older formats  */
     import * as cptable from 'https://cdn.sheetjs.com/xlsx-${current}/package/dist/cpexcel.full.mjs';
     XLSX.set_cptable(cptable);
    -
    +\n\
     const url = "https://oss.sheetjs.com/test_files/formula_stress_test.xlsx";
     // highlight-next-line
     const data = await (await fetch(url)).arrayBuffer();
     /* data is an ArrayBuffer */
    -const workbook = XLSX.read(data);`}
    +const workbook = XLSX.read(data);`} :::note @@ -643,21 +643,21 @@ For these streams, `std` provides a `readAll` method to collect data into a `Uint8Array`. This example reads from a file using `Deno.open` and prints the worksheet names array: -
    {`\
    +{`\
     // @deno-types="https://cdn.sheetjs.com/xlsx-${current}/package/types/index.d.ts"
     import * as XLSX from 'https://cdn.sheetjs.com/xlsx-${current}/package/xlsx.mjs';
    -
    +\n\
     import { readAll } from "https://deno.land/std/streams/conversion.ts";
    -
    +\n\
     /* Simple Deno.Reader from a file */
     const file = await Deno.open("test.xlsx", {read: true});
    -
    +\n\
     /* \`content\` will be a Uint8Array holding the full contents of the stream */
     const content = await readAll(file);
    -
    +\n\
     /* Since this is a Uint8Array, \`XLSX.read\` "just works" */
     const wb = XLSX.read(content);
    -console.log(wb.SheetNames);`}
    +console.log(wb.SheetNames);`}
    diff --git a/docz/docs/06-solutions/05-output.md b/docz/docs/06-solutions/05-output.md index 906fba7..3c1d921 100644 --- a/docz/docs/06-solutions/05-output.md +++ b/docz/docs/06-solutions/05-output.md @@ -212,11 +212,11 @@ writeFile(workbook, "out.xlsb"); `writeFile` uses `Deno.writeFileSync` under the hood: -
    {`\
    +{`\
     // @deno-types="https://cdn.sheetjs.com/xlsx-${current}/package/types/index.d.ts"
     import * as XLSX from 'https://cdn.sheetjs.com/xlsx-${current}/package/xlsx.mjs';
    -
    -XLSX.writeFile(workbook, "test.xlsx");`}
    +\n\ +XLSX.writeFile(workbook, "test.xlsx");`} :::note @@ -338,9 +338,9 @@ res.end(buf); Install the library with -
    {`\
    +{`\
     npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
    -
    + Save the following script to `node.js` and run with `node node.js`: @@ -540,7 +540,7 @@ req.send(formdata); `XLSX.write` with `type: "buffer"` will generate a NodeJS `Buffer` which can be used with standard NodeJS approaches for uploading data. -Node 17.5 and 18.0 have native support for fetch: +NodeJS releases starting from version 18.0 have native support for fetch: ```js const XLSX = require("xlsx"); diff --git a/docz/docs/08-api/07-write-options.md b/docz/docs/08-api/07-write-options.md index f8bd783..fd8e64a 100644 --- a/docz/docs/08-api/07-write-options.md +++ b/docz/docs/08-api/07-write-options.md @@ -7,6 +7,7 @@ title: Writing Files import current from '/version.js'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; +import CodeBlock from '@theme/CodeBlock'; **`XLSX.write(wb, options)`** @@ -106,9 +107,9 @@ Adding NUMBERS export support involves two steps: - +

    https://cdn.sheetjs.com/xlsx-{current}/package/dist/xlsx.zahl.js is the URL for {current}

    -
    {`\
    +{`\
     \n\
     \n\
     \n\
    @@ -122,16 +123,16 @@ var wb = XLSX.utils.book_new(); var ws = XLSX.utils.aoa_to_sheet([\n\
     ]); XLSX.utils.book_append_sheet(wb, ws, "Sheet1");\n\
     XLSX.writeFile(wb, "textport.numbers", {numbers: XLSX_ZAHL_PAYLOAD, compression: true});\n\
     \n\
    -`}
    +`}
    After installing the package: -
    {`\
    +{`\
     npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
    -
    + The scripts will be available at `xlsx/dist/xlsx.zahl` (CommonJS) and `xlsx/dist/xlsx.zahl.mjs` (ESM). @@ -153,9 +154,9 @@ XLSX.writeFile(wb, "textport.numbers", {numbers: XLSX_ZAHL_PAYLOAD, compression: After installing the package: -
    {`\
    +{`\
     npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
    -
    + The scripts will be available at `xlsx/dist/xlsx.zahl` (CommonJS) and `xlsx/dist/xlsx.zahl.mjs` (ESM). @@ -177,12 +178,12 @@ XLSX.writeFile(wb, "textport.numbers", {numbers: XLSX_ZAHL_PAYLOAD, compression:
    - +

    https://cdn.sheetjs.com/xlsx-{current}/package/dist/xlsx.zahl.mjs is the URL for {current}

    -
    {`\
    +{`\
     import * as XLSX from 'https://cdn.sheetjs.com/xlsx-${current}/package/xlsx.mjs';\n\
     import XLSX_ZAHL_PAYLOAD from 'https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.zahl.mjs';\n\
    -
    +\n\
     var wb = XLSX.utils.book_new(); var ws = XLSX.utils.aoa_to_sheet([\n\
       ["SheetJS", "<3","விரிதாள்"],\n\
       [72,,"Arbeitsblätter"],\n\
    @@ -190,7 +191,7 @@ var wb = XLSX.utils.book_new(); var ws = XLSX.utils.aoa_to_sheet([\n\
       [true,false,],\n\
     ]); XLSX.utils.book_append_sheet(wb, ws, "Sheet1");\n\
     XLSX.writeFile(wb, "textport.numbers", {numbers: XLSX_ZAHL_PAYLOAD, compression: true});\n\
    -`}
    +`}
    diff --git a/docz/docs/09-miscellany/02-errors.md b/docz/docs/09-miscellany/02-errors.md index 315fba9..948db7d 100644 --- a/docz/docs/09-miscellany/02-errors.md +++ b/docz/docs/09-miscellany/02-errors.md @@ -5,6 +5,7 @@ hide_table_of_contents: true --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; Here are some common errors and their resolutions. This is not comprehensive. The [issue tracker](https://git.sheetjs.com/SheetJS/sheetjs/issues) has a @@ -263,11 +264,11 @@ that include more browser-specific workarounds. _Standalone Build_ -
    {`\
    +{`\
     
    -`}
    -
    -
    + +`} + _Frameworks and Bundlers_ diff --git a/docz/docs/09-miscellany/05-contributing.md b/docz/docs/09-miscellany/05-contributing.md index bb30018..e380ae7 100644 --- a/docz/docs/09-miscellany/05-contributing.md +++ b/docz/docs/09-miscellany/05-contributing.md @@ -222,7 +222,7 @@ cd sheetjs ```bash # Install dev dependencies -npm install +npm i # Install global dependencies sudo npm i -g mocha@2.5.3 voc @sheetjs/uglify-js diff --git a/docz/docs/index.md b/docz/docs/index.md index 2c1fd29..ab788a0 100644 --- a/docz/docs/index.md +++ b/docz/docs/index.md @@ -5,6 +5,7 @@ title: Overview --- import current from '/version.js'; +import CodeBlock from '@theme/CodeBlock'; # SheetJS CE @@ -34,9 +35,9 @@ run entirely in the web browser. 2) Include a reference to the SheetJS library in your page: -
    {`\
    +{`\
     `}
    -
    + 3) Add a button that users will click to generate an export @@ -113,9 +114,9 @@ support for CSS styling and rich text. 2) Include a reference to the SheetJS library in your page: -
    {`\
    +{`\
     `}
    -
    + 3) Add a script block to download and update the page: diff --git a/docz/docusaurus.config.js b/docz/docusaurus.config.js index 19e1c34..09976b1 100644 --- a/docz/docusaurus.config.js +++ b/docz/docusaurus.config.js @@ -142,7 +142,7 @@ const config = { prism: { theme: lightCodeTheme, darkTheme: darkCodeTheme, - additionalLanguages: [ "swift", "java", "csharp", "perl", "ruby", "cpp", "applescript" ], + additionalLanguages: [ "swift", "java", "csharp", "perl", "ruby", "cpp", "applescript", "liquid" ], }, liveCodeBlock: { playgroundPosition: 'top' diff --git a/docz/src/theme/prism-include-languages.js b/docz/src/theme/prism-include-languages.js new file mode 100644 index 0000000..12e76c8 --- /dev/null +++ b/docz/src/theme/prism-include-languages.js @@ -0,0 +1,25 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + import siteConfig from '@generated/docusaurus.config'; + export default function prismIncludeLanguages(PrismObject) { + const { + themeConfig: {prism}, + } = siteConfig; + const {additionalLanguages} = prism; + // Prism components work on the Prism instance on the window, while prism- + // react-renderer uses its own Prism instance. We temporarily mount the + // instance onto window, import components to enhance it, then remove it to + // avoid polluting global namespace. + // You can mutate PrismObject: registering plugins, deleting languages... As + // long as you don't re-assign it + globalThis.Prism = PrismObject; + additionalLanguages.forEach((lang) => { + // eslint-disable-next-line global-require, import/no-dynamic-require + require(`prismjs/components/prism-${lang}`); + }); + //delete globalThis.Prism; // <-- If this line is not commented, `liquid` will fail. +} diff --git a/docz/static/eleventy/_eleventy.js b/docz/static/eleventy/_eleventy.js new file mode 100644 index 0000000..2594d3e --- /dev/null +++ b/docz/static/eleventy/_eleventy.js @@ -0,0 +1,21 @@ +const XLSX = require("xlsx"); + +/* list of file extensions */ +const exts = [ "numbers", "xlsx", "xlsb", "xls" ].join(", "); + +module.exports = (eleventyConfig) => { + eleventyConfig.addDataExtension(exts, { + /* read file and pass raw Buffer object to parser */ + // highlight-next-line + encoding: null, read: true, + + /* parser callback */ + parser: (contents) => { + /* contents is the data stored as a Buffer */ + // highlight-next-line + const wb = XLSX.read(contents); + /* generate array of row objects from first worksheet */ + return XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]); + } + }); +}; diff --git a/docz/static/eleventy/index.njk b/docz/static/eleventy/index.njk new file mode 100644 index 0000000..16892b4 --- /dev/null +++ b/docz/static/eleventy/index.njk @@ -0,0 +1,10 @@ + + + {% for row in pres %} + + + + + {% endfor %} + +
    NameIndex
    {{ row.Name }}{{ row.Index }}
    \ No newline at end of file