mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 06:38:07 +02:00
Merge pull request #18248 from timvandermeij/metalsmith
Replace Wintersmith with Metalsmith
This commit is contained in:
commit
831a526c10
17 changed files with 1127 additions and 7261 deletions
|
@ -1,20 +0,0 @@
|
||||||
{
|
|
||||||
"locals": {
|
|
||||||
"url": "http://localhost:8080",
|
|
||||||
"name": "PDF.js Documentation",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"typogr": "typogr"
|
|
||||||
},
|
|
||||||
"jade": {
|
|
||||||
"pretty": true
|
|
||||||
},
|
|
||||||
"markdown": {
|
|
||||||
"smartLists": true,
|
|
||||||
"smartypants": true
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"./plugins/wintersmith-makerelative.coffee"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
title: API
|
title: API
|
||||||
template: layout.jade
|
layout: layout.njk
|
||||||
|
slug: api
|
||||||
---
|
---
|
||||||
|
|
||||||
# API
|
# API
|
||||||
|
|
100
docs/contents/css/a11y-light.css
Normal file
100
docs/contents/css/a11y-light.css
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
/*!
|
||||||
|
Theme: a11y-light
|
||||||
|
Author: @ericwbailey
|
||||||
|
Maintainer: @ericwbailey
|
||||||
|
|
||||||
|
Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css
|
||||||
|
|
||||||
|
Original source: https://github.com/highlightjs/highlight.js/blob/main/src/styles/a11y-light.css
|
||||||
|
*/
|
||||||
|
|
||||||
|
.hljs {
|
||||||
|
background: #fefefe;
|
||||||
|
color: #545454;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Comment */
|
||||||
|
.hljs-comment,
|
||||||
|
.hljs-quote {
|
||||||
|
color: #696969;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Red */
|
||||||
|
.hljs-variable,
|
||||||
|
.hljs-template-variable,
|
||||||
|
.hljs-tag,
|
||||||
|
.hljs-name,
|
||||||
|
.hljs-selector-id,
|
||||||
|
.hljs-selector-class,
|
||||||
|
.hljs-regexp,
|
||||||
|
.hljs-deletion {
|
||||||
|
color: #d91e18;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Orange */
|
||||||
|
.hljs-number,
|
||||||
|
.hljs-built_in,
|
||||||
|
.hljs-literal,
|
||||||
|
.hljs-type,
|
||||||
|
.hljs-params,
|
||||||
|
.hljs-meta,
|
||||||
|
.hljs-link {
|
||||||
|
color: #aa5d00;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Yellow */
|
||||||
|
.hljs-attribute {
|
||||||
|
color: #aa5d00;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Green */
|
||||||
|
.hljs-string,
|
||||||
|
.hljs-symbol,
|
||||||
|
.hljs-bullet,
|
||||||
|
.hljs-addition {
|
||||||
|
color: #008000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Blue */
|
||||||
|
.hljs-title,
|
||||||
|
.hljs-section {
|
||||||
|
color: #007faa;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Purple */
|
||||||
|
.hljs-keyword,
|
||||||
|
.hljs-selector-tag {
|
||||||
|
color: #7928a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-emphasis {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-strong {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (-ms-high-contrast: active) {
|
||||||
|
.hljs-addition,
|
||||||
|
.hljs-attribute,
|
||||||
|
.hljs-built_in,
|
||||||
|
.hljs-bullet,
|
||||||
|
.hljs-comment,
|
||||||
|
.hljs-link,
|
||||||
|
.hljs-literal,
|
||||||
|
.hljs-meta,
|
||||||
|
.hljs-number,
|
||||||
|
.hljs-params,
|
||||||
|
.hljs-string,
|
||||||
|
.hljs-symbol,
|
||||||
|
.hljs-type,
|
||||||
|
.hljs-quote {
|
||||||
|
color: highlight;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hljs-keyword,
|
||||||
|
.hljs-selector-tag {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
10
docs/contents/css/bootstrap.min.css
vendored
10
docs/contents/css/bootstrap.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -1,119 +1,34 @@
|
||||||
body {
|
header {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
border-bottom: 1px solid #e5e7e8;
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
img {
|
||||||
|
height: 42px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.starter-template {
|
|
||||||
padding: 0 15px;
|
main {
|
||||||
}
|
margin: 50px 0;
|
||||||
.navbar-brand {
|
|
||||||
padding: 4px 15px;
|
.description {
|
||||||
}
|
font-size: 20px;
|
||||||
.navbar-brand img {
|
}
|
||||||
height: 42px;
|
|
||||||
}
|
pre {
|
||||||
.navbar {
|
background-color: #f5f5f5;
|
||||||
border-color: #e5e7e8;
|
border: 1px solid #cccccc;
|
||||||
}
|
border-radius: 4px;
|
||||||
.navbar-default .navbar-nav > .active > a,
|
padding: 10px;
|
||||||
.navbar-default .navbar-nav > .active > a:hover,
|
}
|
||||||
.navbar-default .navbar-nav > .active > a:focus {
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #e5e7e8;
|
|
||||||
border-width: 0 1px;
|
|
||||||
position: relative;
|
|
||||||
top: 1px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
padding-top: 40px;
|
border-top: 1px solid #e5e5e5;
|
||||||
padding-bottom: 40px;
|
color: #777777;
|
||||||
margin-top: 100px;
|
padding: 40px 0;
|
||||||
color: #777;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-top: 1px solid #E5E5E5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* code styling */
|
|
||||||
|
|
||||||
code {
|
|
||||||
font-family: 'Anonymous Pro', monospace;
|
|
||||||
font-size: 0.85em;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
pre code {
|
|
||||||
display: block;
|
|
||||||
line-height: 1.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
p code {
|
|
||||||
padding: 0.1em 0.3em 0.2em;
|
|
||||||
border-radius: 0.3em;
|
|
||||||
position: relative;
|
|
||||||
top: -0.15em;
|
|
||||||
background: #444;
|
|
||||||
color: #fff;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* syntax hl stuff */
|
|
||||||
|
|
||||||
code.lang-markdown {
|
|
||||||
color: #424242;
|
|
||||||
}
|
|
||||||
|
|
||||||
code.lang-markdown .header,
|
|
||||||
code.lang-markdown .strong {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
code.lang-markdown .emphasis {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
code.lang-markdown .horizontal_rule,
|
|
||||||
code.lang-markdown .link_label,
|
|
||||||
code.lang-markdown .code,
|
|
||||||
code.lang-markdown .header,
|
|
||||||
code.lang-markdown .link_url {
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
code.lang-markdown .blockquote,
|
|
||||||
code.lang-markdown .bullet {
|
|
||||||
color: #bbb;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tomorrow Theme */
|
|
||||||
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
|
|
||||||
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
|
|
||||||
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
|
|
||||||
.tomorrow-comment, pre .comment, pre .title {
|
|
||||||
color: #8e908c;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo {
|
|
||||||
color: #c82829;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tomorrow-orange, pre .number, pre .preprocessor, pre .built_in, pre .literal, pre .params, pre .constant {
|
|
||||||
color: #f5871f;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tomorrow-yellow, pre .class, pre .ruby .class .title, pre .css .rules .attribute {
|
|
||||||
color: #eab700;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata {
|
|
||||||
color: #718c00;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tomorrow-aqua, pre .css .hexcolor {
|
|
||||||
color: #3e999f;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title {
|
|
||||||
color: #4271ae;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tomorrow-purple, pre .keyword, pre .javascript .function {
|
|
||||||
color: #8959a8;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
title: Examples
|
title: Examples
|
||||||
template: layout.jade
|
layout: layout.njk
|
||||||
|
slug: examples
|
||||||
---
|
---
|
||||||
|
|
||||||
## Hello World Walkthrough
|
## Hello World Walkthrough
|
||||||
|
@ -83,17 +84,17 @@ var scaledViewport = page.getViewport({ scale: scale, });
|
||||||
The example demonstrates how promises can be used to handle errors during loading.
|
The example demonstrates how promises can be used to handle errors during loading.
|
||||||
It also demonstrates how to wait until a page is loaded and rendered.
|
It also demonstrates how to wait until a page is loaded and rendered.
|
||||||
|
|
||||||
<script async src="//jsfiddle.net/pdfjs/9engc9mw/embed/html,css,result/"></script>
|
<script async src="https://jsfiddle.net/pdfjs/9engc9mw/embed/html,css,result/"></script>
|
||||||
|
|
||||||
### Hello World using base64 encoded PDF
|
### Hello World using base64 encoded PDF
|
||||||
|
|
||||||
The PDF.js can accept any decoded base64 data as an array.
|
The PDF.js can accept any decoded base64 data as an array.
|
||||||
|
|
||||||
<script async src="//jsfiddle.net/pdfjs/cq0asLqz/embed/html,css,result/"></script>
|
<script async src="https://jsfiddle.net/pdfjs/cq0asLqz/embed/html,css,result/"></script>
|
||||||
|
|
||||||
### Previous/Next example
|
### Previous/Next example
|
||||||
|
|
||||||
The same canvas cannot be used to perform to draw two pages at the same time --
|
The same canvas cannot be used to perform to draw two pages at the same time --
|
||||||
the example demonstrates how to wait on previous operation to be complete.
|
the example demonstrates how to wait on previous operation to be complete.
|
||||||
|
|
||||||
<script async src="//jsfiddle.net/pdfjs/wagvs9Lf/embed/html,css,result/"></script>
|
<script async src="https://jsfiddle.net/pdfjs/wagvs9Lf/embed/html,css,result/"></script>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
title: Getting Started
|
title: Getting Started
|
||||||
template: layout.jade
|
layout: layout.njk
|
||||||
|
slug: getting_started
|
||||||
---
|
---
|
||||||
|
|
||||||
# Getting Started
|
# Getting Started
|
||||||
|
@ -76,7 +77,7 @@ Note that we only mention the most relevant files and folders.
|
||||||
|
|
||||||
### Prebuilt
|
### Prebuilt
|
||||||
|
|
||||||
```
|
```plaintext
|
||||||
├── build/
|
├── build/
|
||||||
│ ├── pdf.mjs - display layer
|
│ ├── pdf.mjs - display layer
|
||||||
│ ├── pdf.mjs.map - display layer's source map
|
│ ├── pdf.mjs.map - display layer's source map
|
||||||
|
@ -96,7 +97,7 @@ Note that we only mention the most relevant files and folders.
|
||||||
|
|
||||||
### Source
|
### Source
|
||||||
|
|
||||||
```
|
```plaintext
|
||||||
├── docs/ - website source code
|
├── docs/ - website source code
|
||||||
├── examples/ - simple usage examples
|
├── examples/ - simple usage examples
|
||||||
├── extensions/ - browser extension source code
|
├── extensions/ - browser extension source code
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
---
|
---
|
||||||
title: PDF.js
|
title: Home
|
||||||
template: layout.jade
|
layout: layout.njk
|
||||||
|
slug: home
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
<h1 class="text-center">PDF.js</h1>
|
<h1 class="text-center">PDF.js</h1>
|
||||||
<p class="text-center" style="font-size: 20px">A general-purpose, web standards-based platform for parsing and rendering PDFs.
|
<p class="text-center description">A general-purpose, web standards-based platform for parsing and rendering PDFs.</p>
|
||||||
</p>
|
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
<a type="button" class="btn btn-lg btn-default" href="getting_started/#download">Download</a>
|
<a type="button" class="btn btn-outline-dark" href="/getting_started/#download">Download</a>
|
||||||
<a type="button" class="btn btn-lg btn-default" href="https://github.com/mozilla/pdf.js#online-demo">Demo</a>
|
<a type="button" class="btn btn-outline-dark" href="https://github.com/mozilla/pdf.js#online-demo">Demo</a>
|
||||||
<a type="button" class="btn btn-lg btn-default" href="https://github.com/mozilla/pdf.js">GitHub Project</a>
|
<a type="button" class="btn btn-outline-dark" href="https://github.com/mozilla/pdf.js">GitHub Project</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
11
docs/contents/js/bootstrap.min.js
vendored
11
docs/contents/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
4
docs/contents/js/jquery-2.1.0.min.js
vendored
4
docs/contents/js/jquery-2.1.0.min.js
vendored
File diff suppressed because one or more lines are too long
2
docs/contents/js/jquery-3.7.1.min.js
vendored
Normal file
2
docs/contents/js/jquery-3.7.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,15 +0,0 @@
|
||||||
module.exports = (env, callback) ->
|
|
||||||
count = (string, substr) ->
|
|
||||||
num = pos = 0
|
|
||||||
return 1/0 unless substr.length
|
|
||||||
num++ while pos = 1 + string.indexOf(substr, pos)
|
|
||||||
num
|
|
||||||
|
|
||||||
env.helpers.makeRelative = (source, dest) ->
|
|
||||||
return dest unless dest.indexOf("/") == 0
|
|
||||||
depth = count(source, '/') # 1 being /
|
|
||||||
ret = ""
|
|
||||||
ret += "../" while depth = depth - 1
|
|
||||||
ret + dest.substring(1)
|
|
||||||
|
|
||||||
callback()
|
|
52
docs/templates/layout.jade
vendored
52
docs/templates/layout.jade
vendored
|
@ -1,52 +0,0 @@
|
||||||
- makeRelative = env.helpers.makeRelative
|
|
||||||
doctype html
|
|
||||||
html(lang='en')
|
|
||||||
head
|
|
||||||
meta(charset='utf-8')
|
|
||||||
meta(name='viewport', content='width=device-width, initial-scale=1.0')
|
|
||||||
meta(name='description', content='A general-purpose, web standards-based platform for parsing and rendering PDFs.')
|
|
||||||
meta(name='author', content='')
|
|
||||||
link(rel='shortcut icon', href=makeRelative(page.url, '/images/favicon.ico'))
|
|
||||||
title=page.title
|
|
||||||
// Bootstrap core CSS
|
|
||||||
link(href=makeRelative(page.url, '/css/bootstrap.min.css'), rel='stylesheet')
|
|
||||||
// Custom styles for this template
|
|
||||||
link(href=makeRelative(page.url, '/css/main.css'), rel='stylesheet')
|
|
||||||
|
|
||||||
body
|
|
||||||
header.navbar.navbar-default.navbar-static-top
|
|
||||||
.container
|
|
||||||
.navbar-header
|
|
||||||
button.navbar-toggle(type='button', data-toggle='collapse', data-target='.navbar-collapse')
|
|
||||||
span.icon-bar
|
|
||||||
span.icon-bar
|
|
||||||
span.icon-bar
|
|
||||||
a.navbar-brand(href='#')
|
|
||||||
img(src=makeRelative(page.url, '/images/logo.svg'))
|
|
||||||
.collapse.navbar-collapse
|
|
||||||
ul.nav.navbar-nav
|
|
||||||
li(class=(page.url === '/' ? 'active' : ''))
|
|
||||||
a(href=makeRelative(page.url, '/')) Home
|
|
||||||
li(class=(page.url === '/getting_started/' ? 'active' : ''))
|
|
||||||
a(href=makeRelative(page.url, '/getting_started/')) Getting Started
|
|
||||||
li(class=(page.url === '/examples/' ? 'active' : ''))
|
|
||||||
a(href=makeRelative(page.url, '/examples/')) Examples
|
|
||||||
li
|
|
||||||
a(href='https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions') FAQ
|
|
||||||
li(class=(page.url === '/api/' ? 'active' : ''))
|
|
||||||
a(href=makeRelative(page.url, '/api/')) API
|
|
||||||
|
|
||||||
.container
|
|
||||||
.starter-template
|
|
||||||
section.content!= typogr(page.html).typogrify()
|
|
||||||
|
|
||||||
.container
|
|
||||||
footer
|
|
||||||
p ©Mozilla and individual contributors
|
|
||||||
:markdown-it
|
|
||||||
PDF.js is licensed under [Apache](https://github.com/mozilla/pdf.js/blob/master/LICENSE),
|
|
||||||
documentation is licensed under [CC BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/)
|
|
||||||
|
|
||||||
// Bootstrap core JavaScript
|
|
||||||
script(src=makeRelative(page.url, '/js/jquery-2.1.0.min.js'))
|
|
||||||
script(src=makeRelative(page.url, '/js/bootstrap.min.js'))
|
|
56
docs/templates/layout.njk
vendored
Normal file
56
docs/templates/layout.njk
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>{{ sitename }} - {{ title }}</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="description" content="{{ description }}">
|
||||||
|
<meta name="viewport" content="device-width, initial-scale=1.0">
|
||||||
|
<script src="/js/jquery-3.7.1.min.js"></script>
|
||||||
|
<script src="/js/bootstrap.min.js"></script>
|
||||||
|
<link rel="shortcut icon" href="/images/favicon.ico">
|
||||||
|
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="/css/a11y-light.css">
|
||||||
|
<link rel="stylesheet" href="/css/main.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-brand"><img src="/images/logo.svg"></div>
|
||||||
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
|
<ul class="navbar-nav mr-auto">
|
||||||
|
<li class="nav-item {{ 'active' if slug == 'home' else '' }}">
|
||||||
|
<a class="nav-link" href="/">Home</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item {{ 'active' if slug == 'getting_started' else '' }}">
|
||||||
|
<a class="nav-link" href="/getting_started">Getting started</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item {{ 'active' if slug == 'examples' else '' }}">
|
||||||
|
<a class="nav-link" href="/examples">Examples</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item {{ 'active' if slug == 'api' else '' }}">
|
||||||
|
<a class="nav-link" href="/api">API</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions">FAQ</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
<main class="container">
|
||||||
|
{{ contents | safe }}
|
||||||
|
</main>
|
||||||
|
<footer>
|
||||||
|
<p>© Mozilla and individual contributors</p>
|
||||||
|
<p>
|
||||||
|
PDF.js is licensed under <a href="https://github.com/mozilla/pdf.js/blob/master/LICENSE">Apache 2.0</a>,
|
||||||
|
documentation is licensed under <a href="https://creativecommons.org/licenses/by-sa/2.5">CC BY-SA 2.5</a>.
|
||||||
|
</p>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</html>
|
63
gulpfile.mjs
63
gulpfile.mjs
|
@ -25,6 +25,10 @@ import crypto from "crypto";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import gulp from "gulp";
|
import gulp from "gulp";
|
||||||
|
import hljs from "highlight.js";
|
||||||
|
import layouts from "@metalsmith/layouts";
|
||||||
|
import markdown from "@metalsmith/markdown";
|
||||||
|
import Metalsmith from "metalsmith";
|
||||||
import ordered from "ordered-read-streams";
|
import ordered from "ordered-read-streams";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import postcss from "gulp-postcss";
|
import postcss from "gulp-postcss";
|
||||||
|
@ -33,6 +37,7 @@ import postcssDirPseudoClass from "postcss-dir-pseudo-class";
|
||||||
import postcssDiscardComments from "postcss-discard-comments";
|
import postcssDiscardComments from "postcss-discard-comments";
|
||||||
import postcssNesting from "postcss-nesting";
|
import postcssNesting from "postcss-nesting";
|
||||||
import { preprocess } from "./external/builder/builder.mjs";
|
import { preprocess } from "./external/builder/builder.mjs";
|
||||||
|
import relative from "metalsmith-html-relative";
|
||||||
import rename from "gulp-rename";
|
import rename from "gulp-rename";
|
||||||
import replace from "gulp-replace";
|
import replace from "gulp-replace";
|
||||||
import stream from "stream";
|
import stream from "stream";
|
||||||
|
@ -2125,26 +2130,44 @@ function ghPagesPrepare() {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task("wintersmith", async function () {
|
gulp.task("metalsmith", async function () {
|
||||||
const { default: wintersmith } = await import("wintersmith");
|
|
||||||
const env = wintersmith("docs/config.json");
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
env.build(GH_PAGES_DIR, function (error) {
|
Metalsmith(__dirname)
|
||||||
if (error) {
|
.source("docs/contents")
|
||||||
reject(error);
|
.destination(GH_PAGES_DIR)
|
||||||
return;
|
.clean(false)
|
||||||
}
|
.metadata({
|
||||||
|
sitename: "PDF.js",
|
||||||
replaceInFile(
|
siteurl: "https://mozilla.github.io/pdf.js",
|
||||||
GH_PAGES_DIR + "/getting_started/index.html",
|
description:
|
||||||
/STABLE_VERSION/g,
|
"A general-purpose, web standards-based platform for parsing and rendering PDFs.",
|
||||||
config.stableVersion
|
})
|
||||||
);
|
.use(
|
||||||
|
markdown({
|
||||||
console.log("Done building with wintersmith.");
|
engineOptions: {
|
||||||
resolve();
|
highlight: (code, language) =>
|
||||||
});
|
hljs.highlight(code, { language }).value,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.use(
|
||||||
|
layouts({
|
||||||
|
directory: "docs/templates",
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.use(relative())
|
||||||
|
.build(error => {
|
||||||
|
if (error) {
|
||||||
|
reject(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
replaceInFile(
|
||||||
|
`${GH_PAGES_DIR}/getting_started/index.html`,
|
||||||
|
/STABLE_VERSION/g,
|
||||||
|
config.stableVersion
|
||||||
|
);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2155,7 +2178,7 @@ gulp.task(
|
||||||
"generic-legacy",
|
"generic-legacy",
|
||||||
"jsdoc",
|
"jsdoc",
|
||||||
ghPagesPrepare,
|
ghPagesPrepare,
|
||||||
"wintersmith"
|
"metalsmith"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
7871
package-lock.json
generated
7871
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -8,6 +8,8 @@
|
||||||
"@fluent/bundle": "^0.18.0",
|
"@fluent/bundle": "^0.18.0",
|
||||||
"@fluent/dom": "^0.9.0",
|
"@fluent/dom": "^0.9.0",
|
||||||
"@jazzer.js/core": "^2.1.0",
|
"@jazzer.js/core": "^2.1.0",
|
||||||
|
"@metalsmith/layouts": "^2.7.0",
|
||||||
|
"@metalsmith/markdown": "^1.3.0",
|
||||||
"autoprefixer": "^10.4.19",
|
"autoprefixer": "^10.4.19",
|
||||||
"babel-loader": "^9.1.3",
|
"babel-loader": "^9.1.3",
|
||||||
"caniuse-lite": "^1.0.30001632",
|
"caniuse-lite": "^1.0.30001632",
|
||||||
|
@ -33,9 +35,12 @@
|
||||||
"gulp-rename": "^2.0.0",
|
"gulp-rename": "^2.0.0",
|
||||||
"gulp-replace": "^1.1.4",
|
"gulp-replace": "^1.1.4",
|
||||||
"gulp-zip": "^6.0.0",
|
"gulp-zip": "^6.0.0",
|
||||||
|
"highlight.js": "^11.9.0",
|
||||||
"jasmine": "^5.1.0",
|
"jasmine": "^5.1.0",
|
||||||
"jsdoc": "^4.0.3",
|
"jsdoc": "^4.0.3",
|
||||||
"jstransformer-markdown-it": "^3.0.0",
|
"jstransformer-nunjucks": "^1.2.0",
|
||||||
|
"metalsmith": "^2.6.3",
|
||||||
|
"metalsmith-html-relative": "^2.0.1",
|
||||||
"ordered-read-streams": "^2.0.0",
|
"ordered-read-streams": "^2.0.0",
|
||||||
"path2d": "^0.2.0",
|
"path2d": "^0.2.0",
|
||||||
"pngjs": "^7.0.0",
|
"pngjs": "^7.0.0",
|
||||||
|
@ -53,11 +58,9 @@
|
||||||
"tsc-alias": "^1.8.10",
|
"tsc-alias": "^1.8.10",
|
||||||
"ttest": "^4.0.0",
|
"ttest": "^4.0.0",
|
||||||
"typescript": "^5.4.5",
|
"typescript": "^5.4.5",
|
||||||
"typogr": "^0.6.8",
|
|
||||||
"vinyl": "^3.0.0",
|
"vinyl": "^3.0.0",
|
||||||
"webpack": "^5.91.0",
|
"webpack": "^5.91.0",
|
||||||
"webpack-stream": "^7.0.0",
|
"webpack-stream": "^7.0.0",
|
||||||
"wintersmith": "^2.5.0",
|
|
||||||
"yargs": "^17.7.2"
|
"yargs": "^17.7.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue