@bartificer/linkify 2.3.1 → 2.3.3
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/dist/index.js +1 -1
- package/docs/LinkData.class.mjs.html +150 -0
- package/docs/LinkTemplate.class.mjs.html +141 -0
- package/docs/Linkifier.class.mjs.html +411 -0
- package/docs/PageData.class.mjs.html +272 -0
- package/docs/data/search.json +1 -0
- package/docs/defaults.mjs.html +101 -0
- package/docs/externals.jsdoc.html +37 -0
- package/docs/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/index.html +28 -0
- package/docs/index.js.html +49 -0
- package/docs/module-LinkData.LinkData.html +13 -0
- package/docs/module-LinkData.html +3 -0
- package/docs/module-LinkTemplate.LinkTemplate.html +3 -0
- package/docs/module-LinkTemplate.html +3 -0
- package/docs/module-Linkifier.Linkifier.html +3 -0
- package/docs/module-Linkifier.html +3 -0
- package/docs/module-PageData.PageData.html +15 -0
- package/docs/module-PageData.html +3 -0
- package/docs/module-cheerio.html +3 -0
- package/docs/module-defaults.html +3 -0
- package/docs/module-linkify.html +3 -0
- package/docs/module-mustache.html +3 -0
- package/docs/module-node-fetch.html +3 -0
- package/docs/module-title-case.html +3 -0
- package/docs/module-urijs.html +3 -0
- package/docs/module-url-slug.html +3 -0
- package/docs/module-utilities.html +3 -0
- package/docs/scripts/core.js +726 -0
- package/docs/scripts/core.min.js +23 -0
- package/docs/scripts/resize.js +90 -0
- package/docs/scripts/search.js +265 -0
- package/docs/scripts/search.min.js +6 -0
- package/docs/scripts/third-party/Apache-License-2.0.txt +202 -0
- package/docs/scripts/third-party/fuse.js +9 -0
- package/docs/scripts/third-party/hljs-line-num-original.js +369 -0
- package/docs/scripts/third-party/hljs-line-num.js +1 -0
- package/docs/scripts/third-party/hljs-original.js +5171 -0
- package/docs/scripts/third-party/hljs.js +1 -0
- package/docs/scripts/third-party/popper.js +5 -0
- package/docs/scripts/third-party/tippy.js +1 -0
- package/docs/scripts/third-party/tocbot.js +672 -0
- package/docs/scripts/third-party/tocbot.min.js +1 -0
- package/docs/styles/clean-jsdoc-theme-base.css +1159 -0
- package/docs/styles/clean-jsdoc-theme-dark.css +412 -0
- package/docs/styles/clean-jsdoc-theme-light.css +482 -0
- package/docs/styles/clean-jsdoc-theme-scrollbar.css +30 -0
- package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
- package/docs/styles/clean-jsdoc-theme.min.css +1 -0
- package/docs/utilities.mjs.html +151 -0
- package/package.json +8 -3
- package/src/LinkData.class.mjs +13 -0
- package/src/LinkTemplate.class.mjs +14 -0
- package/src/Linkifier.class.mjs +22 -2
- package/src/PageData.class.mjs +13 -0
- package/src/defaults.mjs +22 -0
- package/src/externals.jsdoc +35 -0
- package/src/index.js +40 -5
- package/src/utilities.mjs +23 -8
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
<!DOCTYPE html><html lang="en" style="font-size:16px"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Source: PageData.class.mjs</title><!--[if lt IE 9]>
|
|
2
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
3
|
+
<![endif]--><script src="scripts/third-party/hljs.js" defer="defer"></script><script src="scripts/third-party/hljs-line-num.js" defer="defer"></script><script src="scripts/third-party/popper.js" defer="defer"></script><script src="scripts/third-party/tippy.js" defer="defer"></script><script src="scripts/third-party/tocbot.min.js"></script><script>var baseURL="/",locationPathname="";baseURL=(locationPathname=document.location.pathname).substr(0,locationPathname.lastIndexOf("/")+1)</script><link rel="stylesheet" href="styles/clean-jsdoc-theme.min.css"><svg aria-hidden="true" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none"><defs><symbol id="copy-icon" viewbox="0 0 488.3 488.3"><g><path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124 C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124 c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/><path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227 c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6 V38.6C439.65,17.3,422.35,0,401.05,0z"/></g></symbol><symbol id="search-icon" viewBox="0 0 512 512"><g><g><path d="M225.474,0C101.151,0,0,101.151,0,225.474c0,124.33,101.151,225.474,225.474,225.474 c124.33,0,225.474-101.144,225.474-225.474C450.948,101.151,349.804,0,225.474,0z M225.474,409.323 c-101.373,0-183.848-82.475-183.848-183.848S124.101,41.626,225.474,41.626s183.848,82.475,183.848,183.848 S326.847,409.323,225.474,409.323z"/></g></g><g><g><path d="M505.902,476.472L386.574,357.144c-8.131-8.131-21.299-8.131-29.43,0c-8.131,8.124-8.131,21.306,0,29.43l119.328,119.328 c4.065,4.065,9.387,6.098,14.715,6.098c5.321,0,10.649-2.033,14.715-6.098C514.033,497.778,514.033,484.596,505.902,476.472z"/></g></g></symbol><symbol id="font-size-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.246 15H4.754l-2 5H.6L7 4h2l6.4 16h-2.154l-2-5zm-.8-2L8 6.885 5.554 13h4.892zM21 12.535V12h2v8h-2v-.535a4 4 0 1 1 0-6.93zM19 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></symbol><symbol id="add-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></symbol><symbol id="minus-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M5 11h14v2H5z"/></symbol><symbol id="dark-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z"/></symbol><symbol id="light-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></symbol><symbol id="reset-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M18.537 19.567A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10c0 2.136-.67 4.116-1.81 5.74L17 12h3a8 8 0 1 0-2.46 5.772l.997 1.795z"/></symbol><symbol id="down-icon" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></symbol><symbol id="codepen-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M16.5 13.202L13 15.535v3.596L19.197 15 16.5 13.202zM14.697 12L12 10.202 9.303 12 12 13.798 14.697 12zM20 10.869L18.303 12 20 13.131V10.87zM19.197 9L13 4.869v3.596l3.5 2.333L19.197 9zM7.5 10.798L11 8.465V4.869L4.803 9 7.5 10.798zM4.803 15L11 19.131v-3.596l-3.5-2.333L4.803 15zM4 13.131L5.697 12 4 10.869v2.262zM2 9a1 1 0 0 1 .445-.832l9-6a1 1 0 0 1 1.11 0l9 6A1 1 0 0 1 22 9v6a1 1 0 0 1-.445.832l-9 6a1 1 0 0 1-1.11 0l-9-6A1 1 0 0 1 2 15V9z"/></symbol><symbol id="close-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></symbol><symbol id="menu-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"/></symbol></defs></svg></head><body data-theme="fallback-light"><div class="sidebar-container"><div class="sidebar" id="sidebar"><a href="/" class="sidebar-title sidebar-title-anchor">Bartificer Linkifier</a><div class="sidebar-items-container"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.html">PageData</a></div><div class="sidebar-section-children"><a href="module-defaults.html">defaults</a></div><div class="sidebar-section-children"><a href="module-linkify.html">linkify</a></div><div class="sidebar-section-children"><a href="module-utilities.html">utilities</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.PageData.html">PageData</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-externals"><div>Externals</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-cheerio.html">cheerio</a></div><div class="sidebar-section-children"><a href="module-mustache.html">mustache</a></div><div class="sidebar-section-children"><a href="module-node-fetch.html">node-fetch</a></div><div class="sidebar-section-children"><a href="module-title-case.html">title-case</a></div><div class="sidebar-section-children"><a href="module-urijs.html">urijs</a></div><div class="sidebar-section-children"><a href="module-url-slug.html">url-slug</a></div></div></div></div></div><div class="navbar-container" id="VuAckcnZhf"><nav class="navbar"><div class="navbar-left-items"></div><div class="navbar-right-items"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div><nav></nav></nav></div><div class="toc-container"><div class="toc-content"><span class="bold">On this page</span><div id="eed4d2a0bfd64539bb9df78095dec881"></div></div></div><div class="body-wrapper"><div class="main-content"><div class="main-wrapper"><section id="source-page" class="source-page"><header><h1 id="title" class="has-anchor">PageData.class.mjs</h1></header><article><pre class="prettyprint source lang-js"><code>/**
|
|
4
|
+
* @file The definition of the class representing a web page.
|
|
5
|
+
* @author Bart Busschots <opensource@bartificer.ie>
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This module provides as class for representing the information extracted from web pages which can be used to generate the link data avaiable for rendering links.
|
|
10
|
+
* @module PageData
|
|
11
|
+
* @requires module:urijs
|
|
12
|
+
*/
|
|
13
|
+
import {default as URI} from 'urijs';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A class representing the data extracted from web pages that can be transformed into link data for use when rendering links.
|
|
17
|
+
*/
|
|
18
|
+
export class PageData {
|
|
19
|
+
/**
|
|
20
|
+
* This constructor throws a {@link ValidationError} unless a valid URL is passed.
|
|
21
|
+
*
|
|
22
|
+
* @param {URL} url - The page's full URL.
|
|
23
|
+
* @throws {ValidationError} A validation error is thrown if an invalid URL
|
|
24
|
+
* is passed.
|
|
25
|
+
*/
|
|
26
|
+
constructor(url){
|
|
27
|
+
// TO DO - add validation
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The page's URL as a URI object.
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
* @type {URIObject}
|
|
34
|
+
*/
|
|
35
|
+
this._uri = URI();
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The page's title.
|
|
39
|
+
*
|
|
40
|
+
* @private
|
|
41
|
+
* @type {string}
|
|
42
|
+
*/
|
|
43
|
+
this._title = '';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The section headings on the page as arrays of strings indexed by
|
|
47
|
+
* `h1` and `h2`.
|
|
48
|
+
*
|
|
49
|
+
* @private
|
|
50
|
+
* @type {plainObject}
|
|
51
|
+
*/
|
|
52
|
+
this._headings = {
|
|
53
|
+
h1: [],
|
|
54
|
+
h2: []
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// store the URL
|
|
58
|
+
this.url = url;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @returns {string}
|
|
63
|
+
*/
|
|
64
|
+
get url(){
|
|
65
|
+
return this._uri.toString();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @param {string} url - A URL as a string.
|
|
70
|
+
* @throws {ValidationError} A validation error is thrown if an argument
|
|
71
|
+
* is passed that's not a valid URL string.
|
|
72
|
+
*/
|
|
73
|
+
set url(url){
|
|
74
|
+
this._uri = URI(url).normalize();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @returns {Object} A URI.js object.
|
|
79
|
+
*/
|
|
80
|
+
get uri(){
|
|
81
|
+
return this._uri.clone();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Get the domain-part of the URL as a string.
|
|
86
|
+
*
|
|
87
|
+
* @returns {string} The domain-part of the URL.
|
|
88
|
+
*/
|
|
89
|
+
get domain(){
|
|
90
|
+
return this._uri.hostname();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @returns {string} The path-part of the URL.
|
|
95
|
+
*/
|
|
96
|
+
get path(){
|
|
97
|
+
return this._uri.path();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @returns {string}
|
|
102
|
+
*/
|
|
103
|
+
get title(){
|
|
104
|
+
return this._title;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @param {string} title - the page's title as a string. Values passed will be coerced to strings.
|
|
109
|
+
*/
|
|
110
|
+
set title(title){
|
|
111
|
+
this._title = String(title);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Get the page's section headings.
|
|
116
|
+
*
|
|
117
|
+
* @returns {Object} A plain object containing arrays of strings indexed by `h1` and `h2`.
|
|
118
|
+
*/
|
|
119
|
+
get headings(){
|
|
120
|
+
let ans = {
|
|
121
|
+
h1: [],
|
|
122
|
+
h2: []
|
|
123
|
+
};
|
|
124
|
+
for(let h of this._headings.h1){
|
|
125
|
+
ans.h1.push(h);
|
|
126
|
+
}
|
|
127
|
+
for(let h of this._headings.h2){
|
|
128
|
+
ans.h2.push(h);
|
|
129
|
+
}
|
|
130
|
+
return ans;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The page's top-level headings (`h1` tags).
|
|
135
|
+
*
|
|
136
|
+
* @returns {string[]}
|
|
137
|
+
*/
|
|
138
|
+
get topLevelHeadings(){
|
|
139
|
+
var ans = [];
|
|
140
|
+
for(let h of this._headings.h1){
|
|
141
|
+
ans.push(h);
|
|
142
|
+
}
|
|
143
|
+
return ans;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* An alias for `.topLevelHeadings`.
|
|
148
|
+
* @see PageData#topLevelHeadings
|
|
149
|
+
*/
|
|
150
|
+
get h1s(){
|
|
151
|
+
return this.topLevelHeadings;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The page's secondary headings (`h2` tags).
|
|
156
|
+
*
|
|
157
|
+
* @returns {string[]}
|
|
158
|
+
*/
|
|
159
|
+
get secondaryHeadings(){
|
|
160
|
+
var ans = [];
|
|
161
|
+
for(let h of this._headings.h2){
|
|
162
|
+
ans.push(h);
|
|
163
|
+
}
|
|
164
|
+
return ans;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* An alias for `.secondaryHeadings`.
|
|
169
|
+
* @see PageData#secondaryHeadings
|
|
170
|
+
*/
|
|
171
|
+
get h2s(){
|
|
172
|
+
return this.secondaryHeadings;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The text from the most important heading on the page. If the page
|
|
177
|
+
* has `h1` tags, the first one will be used, if not, the first `h2` tag
|
|
178
|
+
* will be used, and if there's none of those either, an empty string will
|
|
179
|
+
* be returned.
|
|
180
|
+
*
|
|
181
|
+
* @returns {string} Heading text as a string, or an empty string.
|
|
182
|
+
*/
|
|
183
|
+
get mainHeading(){
|
|
184
|
+
if(this._headings.h1.length > 0){
|
|
185
|
+
return this._headings.h1[0];
|
|
186
|
+
}
|
|
187
|
+
if(this._headings.h2.length > 0){
|
|
188
|
+
return this._headings.h2[0];
|
|
189
|
+
}
|
|
190
|
+
return '';
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Add a top-level heading.
|
|
195
|
+
*
|
|
196
|
+
* @param {string} h1Text
|
|
197
|
+
* @returns {PageData} A reference to self to
|
|
198
|
+
* facilitate function chaning.
|
|
199
|
+
*/
|
|
200
|
+
addTopLevelHeading(h1Text){
|
|
201
|
+
// TO DO - add argument validation
|
|
202
|
+
this._headings.h1.push(h1Text);
|
|
203
|
+
return this;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Add a seconary heading.
|
|
208
|
+
*
|
|
209
|
+
* @param {string} h2Text
|
|
210
|
+
* @returns {PageData} A reference to self to
|
|
211
|
+
* facilitate function chaning.
|
|
212
|
+
*/
|
|
213
|
+
addSecondaryHeading(h2Text){
|
|
214
|
+
// TO DO - add argument validation
|
|
215
|
+
this._headings.h2.push(h2Text);
|
|
216
|
+
return this;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Get the page data as a plain object of the form:
|
|
221
|
+
* ```
|
|
222
|
+
* {
|
|
223
|
+
* url: 'http://www.bartificer.net/',
|
|
224
|
+
* title: 'the page title',
|
|
225
|
+
* topLevelHeadings: [ 'first h1', 'second h1' ],
|
|
226
|
+
* secondaryHeadings: [ 'first h2', 'second h2' ],
|
|
227
|
+
* mainHeading: 'first h1',
|
|
228
|
+
* uri: {
|
|
229
|
+
* hostname: 'www.bartificer.net',
|
|
230
|
+
* path: '/',
|
|
231
|
+
* hasPath: false
|
|
232
|
+
* }
|
|
233
|
+
* }
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* Note that the `uri` could contain more fields - it's initialised with
|
|
237
|
+
* output from the `URI.parse()` function from the `URI` module.
|
|
238
|
+
*
|
|
239
|
+
* @returns {Object} A plain object containing the page data.
|
|
240
|
+
* @see {@link https://medialize.github.io/URI.js/docs.html#static-parse}
|
|
241
|
+
*/
|
|
242
|
+
asPlainObject(){
|
|
243
|
+
let ans = {
|
|
244
|
+
url: this.url,
|
|
245
|
+
title: this.title,
|
|
246
|
+
topLevelHeadings: this.topLevelHeadings,
|
|
247
|
+
secondaryHeadings: this.secondaryHeadings,
|
|
248
|
+
mainHeading: this.mainHeading,
|
|
249
|
+
uri: URI.parse(this._uri.toString())
|
|
250
|
+
};
|
|
251
|
+
ans.uri.hasPath = ans.uri.path !== '/';
|
|
252
|
+
return ans;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* A shortcut for `.addTopLevelHeading()`.
|
|
258
|
+
*
|
|
259
|
+
* @function
|
|
260
|
+
* @see PageData#addTopLevelHeading
|
|
261
|
+
*
|
|
262
|
+
*/
|
|
263
|
+
PageData.prototype.h1 = PageData.prototype.addTopLevelHeading;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* A shortcut for `.addSecondaryHeading()`.
|
|
267
|
+
*
|
|
268
|
+
* @function
|
|
269
|
+
* @see PageData#addSecondaryHeading
|
|
270
|
+
*
|
|
271
|
+
*/
|
|
272
|
+
PageData.prototype.h2 = PageData.prototype.addSecondaryHeading;</code></pre></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><a href="/" class="sidebar-title sidebar-title-anchor">Bartificer Linkifier</a><div class="mobile-nav-links"></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.html">PageData</a></div><div class="sidebar-section-children"><a href="module-defaults.html">defaults</a></div><div class="sidebar-section-children"><a href="module-linkify.html">linkify</a></div><div class="sidebar-section-children"><a href="module-utilities.html">utilities</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.PageData.html">PageData</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-externals"><div>Externals</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-cheerio.html">cheerio</a></div><div class="sidebar-section-children"><a href="module-mustache.html">mustache</a></div><div class="sidebar-section-children"><a href="module-node-fetch.html">node-fetch</a></div><div class="sidebar-section-children"><a href="module-title-case.html">title-case</a></div><div class="sidebar-section-children"><a href="module-urijs.html">urijs</a></div><div class="sidebar-section-children"><a href="module-url-slug.html">url-slug</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"list":[{"title":"LinkData.class.mjs","link":"<a href=\"LinkData.class.mjs.html\">LinkData.class.mjs</a>","description":"<p>The definition of the class representing a link.</p>"},{"title":"LinkTemplate.class.mjs","link":"<a href=\"LinkTemplate.class.mjs.html\">LinkTemplate.class.mjs</a>","description":"<p>The definition of the class representing a link generation template.</p>"},{"title":"Linkifier.class.mjs","link":"<a href=\"Linkifier.class.mjs.html\">Linkifier.class.mjs</a>","description":"<p>The definition of the main Linkifier class which provides the link rendering functionality with the help of the other classes and modules.</p>"},{"title":"PageData.class.mjs","link":"<a href=\"PageData.class.mjs.html\">PageData.class.mjs</a>","description":"<p>The definition of the class representing a web page.</p>"},{"title":"defaults.mjs","link":"<a href=\"defaults.mjs.html\">defaults.mjs</a>","description":"<p>The default values used throughout the linkifier classes.</p>"},{"title":"index.js","link":"<a href=\"index.js.html\">index.js</a>","description":"<p>The module's entry point. This file determines what does and does not get exported by the module.</p>"},{"title":"module:LinkData","link":"<a href=\"module-LinkData.html\">LinkData</a>","description":"<p>This module provides as class for representing the information that can be used when rendering a link.</p>"},{"title":"module:LinkData.LinkData","link":"<a href=\"module-LinkData.LinkData.html\">LinkData</a>","description":"<p>This constructor throws a {@link ValidationError} unless a valid URL is passed.</p>"},{"title":"module:LinkData.LinkData#asPlainObject","link":"<a href=\"module-LinkData.LinkData.html#asPlainObject\">asPlainObject</a>","description":"<p>Get the link data as a plain object of the form:</p>\n<pre class=\"prettyprint source\"><code>{\n url: 'http://www.bartificer.net/',\n text: 'the link text',\n description: 'the link description',\n uri: {\n hostname: 'www.bartificer.net',\n path: '/',\n hasPath: false\n }\n}\n</code></pre>\n<p>Note that the <code>uri</code> could contain more fields - it's initialised with\noutput from the <code>URI.parse()</code> function from the <code>URI</code> module.</p>"},{"title":"module:LinkData.LinkData#description","link":"<a href=\"module-LinkData.LinkData.html#description\">description</a>"},{"title":"module:LinkData.LinkData#description","link":"<a href=\"module-LinkData.LinkData.html#description\">description</a>"},{"title":"module:LinkData.LinkData#text","link":"<a href=\"module-LinkData.LinkData.html#text\">text</a>"},{"title":"module:LinkData.LinkData#text","link":"<a href=\"module-LinkData.LinkData.html#text\">text</a>"},{"title":"module:LinkData.LinkData#uri","link":"<a href=\"module-LinkData.LinkData.html#uri\">uri</a>","description":"<p>Get the URL as a URI.js object.</p>"},{"title":"module:LinkData.LinkData#url","link":"<a href=\"module-LinkData.LinkData.html#url\">url</a>"},{"title":"module:LinkData.LinkData#url","link":"<a href=\"module-LinkData.LinkData.html#url\">url</a>","description":"<p>Get or set the URL.</p>"},{"title":"module:LinkTemplate","link":"<a href=\"module-LinkTemplate.html\">LinkTemplate</a>","description":"<p>This module provides as class for representing a template used for generating links.</p>"},{"title":"module:LinkTemplate.LinkTemplate","link":"<a href=\"module-LinkTemplate.LinkTemplate.html\">LinkTemplate</a>"},{"title":"module:LinkTemplate.LinkTemplate#addFilter","link":"<a href=\"module-LinkTemplate.LinkTemplate.html#addFilter\">addFilter</a>","description":"<p>Add a filter to be applied to one or all fields.</p>\n<p>If an invalid args are passed, the function does not save the filter or\nthrow an error, but it does log a warning.</p>"},{"title":"module:LinkTemplate.LinkTemplate#filtersFor","link":"<a href=\"module-LinkTemplate.LinkTemplate.html#filtersFor\">filtersFor</a>","description":"<p>A function get the filter functions that should be applied to any given\nfield.</p>"},{"title":"module:LinkTemplate.LinkTemplate#templateString","link":"<a href=\"module-LinkTemplate.LinkTemplate.html#templateString\">templateString</a>","description":"<p>Get the template string.</p>"},{"title":"module:LinkTemplate.LinkTemplate#templateString","link":"<a href=\"module-LinkTemplate.LinkTemplate.html#templateString\">templateString</a>","description":"<p>Set the template string. Should be in Mustache format. All values passed\nwill be coerced to strings.</p>"},{"title":"module:Linkifier","link":"<a href=\"module-Linkifier.html\">Linkifier</a>","description":"<p>Linkifier's core link rendering functionality.</p>"},{"title":"module:Linkifier.Linkifier","link":"<a href=\"module-Linkifier.Linkifier.html\">Linkifier</a>"},{"title":"module:Linkifier.Linkifier#defaultTemplate","link":"<a href=\"module-Linkifier.Linkifier.html#defaultTemplate\">defaultTemplate</a>","description":"<p>The default link template.</p>"},{"title":"module:Linkifier.Linkifier#defaultTemplateName","link":"<a href=\"module-Linkifier.Linkifier.html#defaultTemplateName\">defaultTemplateName</a>"},{"title":"module:Linkifier.Linkifier#defaultTemplateName","link":"<a href=\"module-Linkifier.Linkifier.html#defaultTemplateName\">defaultTemplateName</a>"},{"title":"module:Linkifier.Linkifier#fetchPageData","link":"<a href=\"module-Linkifier.Linkifier.html#fetchPageData\">fetchPageData</a>","description":"<p>Fetch the page data for a given URL.</p>"},{"title":"module:Linkifier.Linkifier#generateLink","link":"<a href=\"module-Linkifier.Linkifier.html#generateLink\">generateLink</a>","description":"<p>Generate a link given a URL. By default the registered template for the\nURL's domain will be used, or, if none is registered, the overall\ndefault will be used (<code>html</code>).</p>"},{"title":"module:Linkifier.Linkifier#getTemplate","link":"<a href=\"module-Linkifier.Linkifier.html#getTemplate\">getTemplate</a>","description":"<p>Get a registered link template by name.</p>"},{"title":"module:Linkifier.Linkifier#getTemplateNameForDomain","link":"<a href=\"module-Linkifier.Linkifier.html#getTemplateNameForDomain\">getTemplateNameForDomain</a>","description":"<p>Get the data transformer function for a given domain.</p>\n<p>Note that domains are searched from the subdomain up. For example, if passed\nthe domain <code>www.bartificer.net</code> the function will first look for a\ntransformer for the domain <code>www.bartificer.net</code>, if there's no transformer\nregistered for that domain it will look for a transformer for the domain\n<code>bartificer.net</code>, if there's no transformer for that domain either it will\nreturn the default transformer.</p>"},{"title":"module:Linkifier.Linkifier#getTransformerForDomain","link":"<a href=\"module-Linkifier.Linkifier.html#getTransformerForDomain\">getTransformerForDomain</a>","description":"<p>Get the data transformer function for a given domain.</p>\n<p>Note that domains are searched from the subdomain up. For example, if passed\nthe domain <code>www.bartificer.net</code> the function will first look for a\ntransformer for the domain <code>www.bartificer.net</code>, if there's no transformer\nregistered for that domain it will look for a transformer for the domain\n<code>bartificer.net</code>, if there's no transformer for that domain either it will\nreturn the default transformer.</p>"},{"title":"module:Linkifier.Linkifier#registerDefaultTemplateMapping","link":"<a href=\"module-Linkifier.Linkifier.html#registerDefaultTemplateMapping\">registerDefaultTemplateMapping</a>","description":"<p>Register a default template for use with a given domain. This template will\noverride the overall default for this domain and all its subdomains.</p>"},{"title":"module:Linkifier.Linkifier#registerTemplate","link":"<a href=\"module-Linkifier.Linkifier.html#registerTemplate\">registerTemplate</a>","description":"<p>Register a link template.</p>"},{"title":"module:Linkifier.Linkifier#registerTransformer","link":"<a href=\"module-Linkifier.Linkifier.html#registerTransformer\">registerTransformer</a>","description":"<p>Register a data transformer function for a given domain.</p>"},{"title":"module:Linkifier.Linkifier#speciallyCapitalisedWords","link":"<a href=\"module-Linkifier.Linkifier.html#speciallyCapitalisedWords\">speciallyCapitalisedWords</a>"},{"title":"module:Linkifier.Linkifier#speciallyCapitalisedWords","link":"<a href=\"module-Linkifier.Linkifier.html#speciallyCapitalisedWords\">speciallyCapitalisedWords</a>"},{"title":"module:Linkifier.Linkifier#templateNames","link":"<a href=\"module-Linkifier.Linkifier.html#templateNames\">templateNames</a>","description":"<p>A list of the names of the registered link templates.</p>"},{"title":"module:Linkifier.Linkifier#util","link":"<a href=\"module-Linkifier.Linkifier.html#util\">util</a>"},{"title":"module:Linkifier.Linkifier#utilities","link":"<a href=\"module-Linkifier.Linkifier.html#utilities\">utilities</a>"},{"title":"module:PageData","link":"<a href=\"module-PageData.html\">PageData</a>","description":"<p>This module provides as class for representing the information extracted from web pages which can be used to generate the link data avaiable for rendering links.</p>"},{"title":"module:PageData.PageData","link":"<a href=\"module-PageData.PageData.html\">PageData</a>","description":"<p>This constructor throws a {@link ValidationError} unless a valid URL is passed.</p>"},{"title":"module:PageData.PageData#addSecondaryHeading","link":"<a href=\"module-PageData.PageData.html#addSecondaryHeading\">addSecondaryHeading</a>","description":"<p>Add a seconary heading.</p>"},{"title":"module:PageData.PageData#addTopLevelHeading","link":"<a href=\"module-PageData.PageData.html#addTopLevelHeading\">addTopLevelHeading</a>","description":"<p>Add a top-level heading.</p>"},{"title":"module:PageData.PageData#asPlainObject","link":"<a href=\"module-PageData.PageData.html#asPlainObject\">asPlainObject</a>","description":"<p>Get the page data as a plain object of the form:</p>\n<pre class=\"prettyprint source\"><code>{\n url: 'http://www.bartificer.net/',\n title: 'the page title',\n topLevelHeadings: [ 'first h1', 'second h1' ],\n secondaryHeadings: [ 'first h2', 'second h2' ],\n mainHeading: 'first h1',\n uri: {\n hostname: 'www.bartificer.net',\n path: '/',\n hasPath: false\n }\n}\n</code></pre>\n<p>Note that the <code>uri</code> could contain more fields - it's initialised with\noutput from the <code>URI.parse()</code> function from the <code>URI</code> module.</p>"},{"title":"module:PageData.PageData#domain","link":"<a href=\"module-PageData.PageData.html#domain\">domain</a>","description":"<p>Get the domain-part of the URL as a string.</p>"},{"title":"module:PageData.PageData#h1","link":"<a href=\"module-PageData.PageData.html#h1\">h1</a>","description":"<p>A shortcut for <code>.addTopLevelHeading()</code>.</p>"},{"title":"module:PageData.PageData#h1s","link":"<a href=\"module-PageData.PageData.html#h1s\">h1s</a>","description":"<p>An alias for <code>.topLevelHeadings</code>.</p>"},{"title":"module:PageData.PageData#h2","link":"<a href=\"module-PageData.PageData.html#h2\">h2</a>","description":"<p>A shortcut for <code>.addSecondaryHeading()</code>.</p>"},{"title":"module:PageData.PageData#h2s","link":"<a href=\"module-PageData.PageData.html#h2s\">h2s</a>","description":"<p>An alias for <code>.secondaryHeadings</code>.</p>"},{"title":"module:PageData.PageData#headings","link":"<a href=\"module-PageData.PageData.html#headings\">headings</a>","description":"<p>Get the page's section headings.</p>"},{"title":"module:PageData.PageData#mainHeading","link":"<a href=\"module-PageData.PageData.html#mainHeading\">mainHeading</a>","description":"<p>The text from the most important heading on the page. If the page\nhas <code>h1</code> tags, the first one will be used, if not, the first <code>h2</code> tag\nwill be used, and if there's none of those either, an empty string will\nbe returned.</p>"},{"title":"module:PageData.PageData#path","link":"<a href=\"module-PageData.PageData.html#path\">path</a>"},{"title":"module:PageData.PageData#secondaryHeadings","link":"<a href=\"module-PageData.PageData.html#secondaryHeadings\">secondaryHeadings</a>","description":"<p>The page's secondary headings (<code>h2</code> tags).</p>"},{"title":"module:PageData.PageData#title","link":"<a href=\"module-PageData.PageData.html#title\">title</a>"},{"title":"module:PageData.PageData#title","link":"<a href=\"module-PageData.PageData.html#title\">title</a>"},{"title":"module:PageData.PageData#topLevelHeadings","link":"<a href=\"module-PageData.PageData.html#topLevelHeadings\">topLevelHeadings</a>","description":"<p>The page's top-level headings (<code>h1</code> tags).</p>"},{"title":"module:PageData.PageData#uri","link":"<a href=\"module-PageData.PageData.html#uri\">uri</a>"},{"title":"module:PageData.PageData#url","link":"<a href=\"module-PageData.PageData.html#url\">url</a>"},{"title":"module:PageData.PageData#url","link":"<a href=\"module-PageData.PageData.html#url\">url</a>"},{"title":"module:cheerio","link":"<a href=\"module-cheerio.html\">module:cheerio</a>","description":"<p>The module used to parse HTML documents in a jQuery-like way in the NodeJS.</p>"},{"title":"module:defaults","link":"<a href=\"module-defaults.html\">defaults</a>","description":"<p>This module provides default values for use by the various linkifier functions and classes. These separated out for clarity, helping users decide which values to override or augment.</p>"},{"title":"module:defaults.linkTemplates","link":"<a href=\"module-defaults.html#.linkTemplates\">linkTemplates</a>","description":"<p>The collection of named link templates loaded by the Linkifier constructor.</p>"},{"title":"module:defaults.speciallyCapitalisedWords","link":"<a href=\"module-defaults.html#.speciallyCapitalisedWords\">speciallyCapitalisedWords</a>","description":"<p>The default list of words with special capitalisations.</p>"},{"title":"module:linkify","link":"<a href=\"module-linkify.html\">linkify</a>","description":"<p>The package entry-point.</p>"},{"title":"module:linkify.LinkData","link":"<a href=\"module-linkify.html#.LinkData\">LinkData</a>","description":"<p>The LinkData class use to store link properties like title and url.</p>"},{"title":"module:linkify.LinkTemplate","link":"<a href=\"module-linkify.html#.LinkTemplate\">LinkTemplate</a>","description":"<p>The LinkTempalte class used for defining the templates for generating links.</p>"},{"title":"module:linkify.Linkifier","link":"<a href=\"module-linkify.html#.Linkifier\">Linkifier</a>","description":"<p>The Linkifier class that encapsulates the link generations functionality.</p>"},{"title":"module:linkify.PageData","link":"<a href=\"module-linkify.html#.PageData\">PageData</a>","description":"<p>The PageData class used to store webpage properties like title and headings.</p>"},{"title":"module:linkify.VERSION","link":"<a href=\"module-linkify.html#.VERSION\">VERSION</a>","description":"<p>The module's current SEMVER version number.</p>"},{"title":"module:linkify.linkify","link":"<a href=\"module-linkify.html#.linkify\">linkify</a>","description":"<p>An instantiated Linkifier object ready for use.</p>"},{"title":"module:mustache","link":"<a href=\"module-mustache.html\">module:mustache</a>","description":"<p>The templating system used to describe link templates and generaete links.</p>"},{"title":"module:node-fetch","link":"<a href=\"module-node-fetch.html\">module:node-fetch</a>","description":"<p>The NPM module used to fetch URLs over HTTP(S).</p>"},{"title":"module:title-case","link":"<a href=\"module-title-case.html\">module:title-case</a>","description":"<p>The module used for intelligent conversions to newspaper-style title-case.</p>"},{"title":"module:urijs","link":"<a href=\"module-urijs.html\">module:urijs</a>","description":"<p>The URI (URL) parser used to parse and process link targets.</p>"},{"title":"module:url-slug","link":"<a href=\"module-url-slug.html\">module:url-slug</a>","description":"<p>The module used to reverse URL slugs back to approximate page titles.</p>"},{"title":"module:utilities","link":"<a href=\"module-utilities.html\">utilities</a>","description":"<p>This module provides utility functions which are both used by the core code, and, available for use by users when defining link data transformers and link templates.</p>"},{"title":"module:utilities.batchFixCustomWordCases","link":"<a href=\"module-utilities.html#.batchFixCustomWordCases\">batchFixCustomWordCases</a>","description":"<p>Batch-customise word casings in a string. E.g. force <code>fbi</code> to <code>FBI</code>, <code>ios</code> to <code>iOS</code>, etc..</p>"},{"title":"module:utilities.escapeRegex","link":"<a href=\"module-utilities.html#.escapeRegex\">escapeRegex</a>","description":"<p>Escape a string for use in regular expressions.</p>\n<p><em><strong>Note:</strong> this is not a standard Javascript feature as of April 2026, though it is coming in future versions of Javascript.</em></p>"},{"title":"module:utilities.extractSlug","link":"<a href=\"module-utilities.html#.extractSlug\">extractSlug</a>","description":"<p>Extract the slug from a URL and convert it to a title-case string.</p>"},{"title":"module:utilities.regulariseWhitespace","link":"<a href=\"module-utilities.html#.regulariseWhitespace\">regulariseWhitespace</a>","description":"<p>Regularise white space by replacing all sequences of whitespace characters with a single space and trimming leading and trailing whitespace.</p>"},{"title":"module:utilities.stripQueryString","link":"<a href=\"module-utilities.html#.stripQueryString\">stripQueryString</a>","description":"<p>Strip the query string from a URL.</p>"},{"title":"module:utilities.stripUTMParameters","link":"<a href=\"module-utilities.html#.stripUTMParameters\">stripUTMParameters</a>","description":"<p>Remove UTM parameters from the query string in a URL.</p>"},{"title":"utilities.mjs","link":"<a href=\"utilities.mjs.html\">utilities.mjs</a>","description":"<p>A collection of useful utility functions.</p>"}]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<!DOCTYPE html><html lang="en" style="font-size:16px"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Source: defaults.mjs</title><!--[if lt IE 9]>
|
|
2
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
3
|
+
<![endif]--><script src="scripts/third-party/hljs.js" defer="defer"></script><script src="scripts/third-party/hljs-line-num.js" defer="defer"></script><script src="scripts/third-party/popper.js" defer="defer"></script><script src="scripts/third-party/tippy.js" defer="defer"></script><script src="scripts/third-party/tocbot.min.js"></script><script>var baseURL="/",locationPathname="";baseURL=(locationPathname=document.location.pathname).substr(0,locationPathname.lastIndexOf("/")+1)</script><link rel="stylesheet" href="styles/clean-jsdoc-theme.min.css"><svg aria-hidden="true" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none"><defs><symbol id="copy-icon" viewbox="0 0 488.3 488.3"><g><path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124 C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124 c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/><path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227 c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6 V38.6C439.65,17.3,422.35,0,401.05,0z"/></g></symbol><symbol id="search-icon" viewBox="0 0 512 512"><g><g><path d="M225.474,0C101.151,0,0,101.151,0,225.474c0,124.33,101.151,225.474,225.474,225.474 c124.33,0,225.474-101.144,225.474-225.474C450.948,101.151,349.804,0,225.474,0z M225.474,409.323 c-101.373,0-183.848-82.475-183.848-183.848S124.101,41.626,225.474,41.626s183.848,82.475,183.848,183.848 S326.847,409.323,225.474,409.323z"/></g></g><g><g><path d="M505.902,476.472L386.574,357.144c-8.131-8.131-21.299-8.131-29.43,0c-8.131,8.124-8.131,21.306,0,29.43l119.328,119.328 c4.065,4.065,9.387,6.098,14.715,6.098c5.321,0,10.649-2.033,14.715-6.098C514.033,497.778,514.033,484.596,505.902,476.472z"/></g></g></symbol><symbol id="font-size-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.246 15H4.754l-2 5H.6L7 4h2l6.4 16h-2.154l-2-5zm-.8-2L8 6.885 5.554 13h4.892zM21 12.535V12h2v8h-2v-.535a4 4 0 1 1 0-6.93zM19 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></symbol><symbol id="add-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></symbol><symbol id="minus-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M5 11h14v2H5z"/></symbol><symbol id="dark-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z"/></symbol><symbol id="light-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></symbol><symbol id="reset-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M18.537 19.567A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10c0 2.136-.67 4.116-1.81 5.74L17 12h3a8 8 0 1 0-2.46 5.772l.997 1.795z"/></symbol><symbol id="down-icon" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></symbol><symbol id="codepen-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M16.5 13.202L13 15.535v3.596L19.197 15 16.5 13.202zM14.697 12L12 10.202 9.303 12 12 13.798 14.697 12zM20 10.869L18.303 12 20 13.131V10.87zM19.197 9L13 4.869v3.596l3.5 2.333L19.197 9zM7.5 10.798L11 8.465V4.869L4.803 9 7.5 10.798zM4.803 15L11 19.131v-3.596l-3.5-2.333L4.803 15zM4 13.131L5.697 12 4 10.869v2.262zM2 9a1 1 0 0 1 .445-.832l9-6a1 1 0 0 1 1.11 0l9 6A1 1 0 0 1 22 9v6a1 1 0 0 1-.445.832l-9 6a1 1 0 0 1-1.11 0l-9-6A1 1 0 0 1 2 15V9z"/></symbol><symbol id="close-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></symbol><symbol id="menu-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"/></symbol></defs></svg></head><body data-theme="fallback-light"><div class="sidebar-container"><div class="sidebar" id="sidebar"><a href="/" class="sidebar-title sidebar-title-anchor">Bartificer Linkifier</a><div class="sidebar-items-container"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.html">PageData</a></div><div class="sidebar-section-children"><a href="module-defaults.html">defaults</a></div><div class="sidebar-section-children"><a href="module-linkify.html">linkify</a></div><div class="sidebar-section-children"><a href="module-utilities.html">utilities</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.PageData.html">PageData</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-externals"><div>Externals</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-cheerio.html">cheerio</a></div><div class="sidebar-section-children"><a href="module-mustache.html">mustache</a></div><div class="sidebar-section-children"><a href="module-node-fetch.html">node-fetch</a></div><div class="sidebar-section-children"><a href="module-title-case.html">title-case</a></div><div class="sidebar-section-children"><a href="module-urijs.html">urijs</a></div><div class="sidebar-section-children"><a href="module-url-slug.html">url-slug</a></div></div></div></div></div><div class="navbar-container" id="VuAckcnZhf"><nav class="navbar"><div class="navbar-left-items"></div><div class="navbar-right-items"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div><nav></nav></nav></div><div class="toc-container"><div class="toc-content"><span class="bold">On this page</span><div id="eed4d2a0bfd64539bb9df78095dec881"></div></div></div><div class="body-wrapper"><div class="main-content"><div class="main-wrapper"><section id="source-page" class="source-page"><header><h1 id="title" class="has-anchor">defaults.mjs</h1></header><article><pre class="prettyprint source lang-js"><code>/**
|
|
4
|
+
* @file The default values used throughout the linkifier classes.
|
|
5
|
+
* @author Bart Busschots <opensource@bartificer.ie>
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This module provides default values for use by the various linkifier functions and classes. These separated out for clarity, helping users decide which values to override or augment.
|
|
10
|
+
* @module defaults
|
|
11
|
+
* @requires module:LinkTemplate
|
|
12
|
+
* @requires module:utilities
|
|
13
|
+
*/
|
|
14
|
+
import { LinkTemplate } from './LinkTemplate.class.mjs';
|
|
15
|
+
import * as utilities from "./utilities.mjs";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The collection of named link templates loaded by the Linkifier constructor.
|
|
19
|
+
* @type {Object.<string, LinkTemplate>}
|
|
20
|
+
*/
|
|
21
|
+
export const linkTemplates = {
|
|
22
|
+
html: new LinkTemplate(
|
|
23
|
+
'<a href="{{{url}}}" title="{{description}}">{{text}}</a>',
|
|
24
|
+
[
|
|
25
|
+
['url', utilities.stripUTMParameters],
|
|
26
|
+
['text', utilities.regulariseWhitespace],
|
|
27
|
+
['description', utilities.regulariseWhitespace]
|
|
28
|
+
]
|
|
29
|
+
),
|
|
30
|
+
htmlNewTab: new LinkTemplate(
|
|
31
|
+
'<a href="{{{url}}}" title="{{description}}" target="_blank" rel="noopener">{{text}}</a>',
|
|
32
|
+
[
|
|
33
|
+
['url', utilities.stripUTMParameters],
|
|
34
|
+
['text', utilities.regulariseWhitespace],
|
|
35
|
+
['description', utilities.regulariseWhitespace]
|
|
36
|
+
]
|
|
37
|
+
),
|
|
38
|
+
markdown: new LinkTemplate(
|
|
39
|
+
'[{{{text}}}]({{{url}}})',
|
|
40
|
+
[
|
|
41
|
+
['url', utilities.stripUTMParameters],
|
|
42
|
+
['text', utilities.regulariseWhitespace]
|
|
43
|
+
]
|
|
44
|
+
)
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The default list of words with special capitalisations.
|
|
49
|
+
* @type {string[]}
|
|
50
|
+
*/
|
|
51
|
+
export const speciallyCapitalisedWords = [
|
|
52
|
+
// generic acronyms
|
|
53
|
+
'FBI',
|
|
54
|
+
'CIA',
|
|
55
|
+
'USA',
|
|
56
|
+
'UK',
|
|
57
|
+
'EU',
|
|
58
|
+
'NASA',
|
|
59
|
+
'NSA',
|
|
60
|
+
'OS',
|
|
61
|
+
'OSes',
|
|
62
|
+
'ID',
|
|
63
|
+
'IDs',
|
|
64
|
+
'MLB',
|
|
65
|
+
'NFL',
|
|
66
|
+
'NASCAR',
|
|
67
|
+
'FIFA',
|
|
68
|
+
'TV',
|
|
69
|
+
'VR',
|
|
70
|
+
'BAFTA',
|
|
71
|
+
'BBC',
|
|
72
|
+
'AI',
|
|
73
|
+
'VP',
|
|
74
|
+
'II',
|
|
75
|
+
'III',
|
|
76
|
+
'IV',
|
|
77
|
+
|
|
78
|
+
// tech jargon
|
|
79
|
+
'iOS',
|
|
80
|
+
'macOS',
|
|
81
|
+
'iPhone',
|
|
82
|
+
'iPad',
|
|
83
|
+
'iPod',
|
|
84
|
+
'AirTag',
|
|
85
|
+
'iPadOS',
|
|
86
|
+
'watchOS',
|
|
87
|
+
'tvOS',
|
|
88
|
+
'CarPlay',
|
|
89
|
+
'AirPods',
|
|
90
|
+
'MacBook',
|
|
91
|
+
'iTunes',
|
|
92
|
+
'WWDC',
|
|
93
|
+
'XDR',
|
|
94
|
+
'XProtect',
|
|
95
|
+
'VESA',
|
|
96
|
+
'HDMI',
|
|
97
|
+
'DisplayPort',
|
|
98
|
+
'LinkedIn',
|
|
99
|
+
'ChatGPT'
|
|
100
|
+
];
|
|
101
|
+
</code></pre></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><a href="/" class="sidebar-title sidebar-title-anchor">Bartificer Linkifier</a><div class="mobile-nav-links"></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.html">PageData</a></div><div class="sidebar-section-children"><a href="module-defaults.html">defaults</a></div><div class="sidebar-section-children"><a href="module-linkify.html">linkify</a></div><div class="sidebar-section-children"><a href="module-utilities.html">utilities</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.PageData.html">PageData</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-externals"><div>Externals</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-cheerio.html">cheerio</a></div><div class="sidebar-section-children"><a href="module-mustache.html">mustache</a></div><div class="sidebar-section-children"><a href="module-node-fetch.html">node-fetch</a></div><div class="sidebar-section-children"><a href="module-title-case.html">title-case</a></div><div class="sidebar-section-children"><a href="module-urijs.html">urijs</a></div><div class="sidebar-section-children"><a href="module-url-slug.html">url-slug</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!DOCTYPE html><html lang="en" style="font-size:16px"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Source: externals.jsdoc</title><!--[if lt IE 9]>
|
|
2
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
3
|
+
<![endif]--><script src="scripts/third-party/hljs.js" defer="defer"></script><script src="scripts/third-party/hljs-line-num.js" defer="defer"></script><script src="scripts/third-party/popper.js" defer="defer"></script><script src="scripts/third-party/tippy.js" defer="defer"></script><script src="scripts/third-party/tocbot.min.js"></script><script>var baseURL="/",locationPathname="";baseURL=(locationPathname=document.location.pathname).substr(0,locationPathname.lastIndexOf("/")+1)</script><link rel="stylesheet" href="styles/clean-jsdoc-theme.min.css"><svg aria-hidden="true" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none"><defs><symbol id="copy-icon" viewbox="0 0 488.3 488.3"><g><path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124 C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124 c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/><path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227 c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6 V38.6C439.65,17.3,422.35,0,401.05,0z"/></g></symbol><symbol id="search-icon" viewBox="0 0 512 512"><g><g><path d="M225.474,0C101.151,0,0,101.151,0,225.474c0,124.33,101.151,225.474,225.474,225.474 c124.33,0,225.474-101.144,225.474-225.474C450.948,101.151,349.804,0,225.474,0z M225.474,409.323 c-101.373,0-183.848-82.475-183.848-183.848S124.101,41.626,225.474,41.626s183.848,82.475,183.848,183.848 S326.847,409.323,225.474,409.323z"/></g></g><g><g><path d="M505.902,476.472L386.574,357.144c-8.131-8.131-21.299-8.131-29.43,0c-8.131,8.124-8.131,21.306,0,29.43l119.328,119.328 c4.065,4.065,9.387,6.098,14.715,6.098c5.321,0,10.649-2.033,14.715-6.098C514.033,497.778,514.033,484.596,505.902,476.472z"/></g></g></symbol><symbol id="font-size-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.246 15H4.754l-2 5H.6L7 4h2l6.4 16h-2.154l-2-5zm-.8-2L8 6.885 5.554 13h4.892zM21 12.535V12h2v8h-2v-.535a4 4 0 1 1 0-6.93zM19 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></symbol><symbol id="add-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></symbol><symbol id="minus-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M5 11h14v2H5z"/></symbol><symbol id="dark-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z"/></symbol><symbol id="light-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></symbol><symbol id="reset-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M18.537 19.567A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10c0 2.136-.67 4.116-1.81 5.74L17 12h3a8 8 0 1 0-2.46 5.772l.997 1.795z"/></symbol><symbol id="down-icon" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></symbol><symbol id="codepen-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M16.5 13.202L13 15.535v3.596L19.197 15 16.5 13.202zM14.697 12L12 10.202 9.303 12 12 13.798 14.697 12zM20 10.869L18.303 12 20 13.131V10.87zM19.197 9L13 4.869v3.596l3.5 2.333L19.197 9zM7.5 10.798L11 8.465V4.869L4.803 9 7.5 10.798zM4.803 15L11 19.131v-3.596l-3.5-2.333L4.803 15zM4 13.131L5.697 12 4 10.869v2.262zM2 9a1 1 0 0 1 .445-.832l9-6a1 1 0 0 1 1.11 0l9 6A1 1 0 0 1 22 9v6a1 1 0 0 1-.445.832l-9 6a1 1 0 0 1-1.11 0l-9-6A1 1 0 0 1 2 15V9z"/></symbol><symbol id="close-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></symbol><symbol id="menu-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"/></symbol></defs></svg></head><body data-theme="fallback-light"><div class="sidebar-container"><div class="sidebar" id="sidebar"><a href="/" class="sidebar-title sidebar-title-anchor">Bartificer Linkifier</a><div class="sidebar-items-container"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.html">PageData</a></div><div class="sidebar-section-children"><a href="module-defaults.html">defaults</a></div><div class="sidebar-section-children"><a href="module-linkify.html">linkify</a></div><div class="sidebar-section-children"><a href="module-utilities.html">utilities</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.PageData.html">PageData</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-externals"><div>Externals</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-cheerio.html">cheerio</a></div><div class="sidebar-section-children"><a href="module-mustache.html">mustache</a></div><div class="sidebar-section-children"><a href="module-node-fetch.html">node-fetch</a></div><div class="sidebar-section-children"><a href="module-title-case.html">title-case</a></div><div class="sidebar-section-children"><a href="module-urijs.html">urijs</a></div><div class="sidebar-section-children"><a href="module-url-slug.html">url-slug</a></div></div></div></div></div><div class="navbar-container" id="VuAckcnZhf"><nav class="navbar"><div class="navbar-left-items"></div><div class="navbar-right-items"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div><nav></nav></nav></div><div class="toc-container"><div class="toc-content"><span class="bold">On this page</span><div id="eed4d2a0bfd64539bb9df78095dec881"></div></div></div><div class="body-wrapper"><div class="main-content"><div class="main-wrapper"><section id="source-page" class="source-page"><header><h1 id="title" class="has-anchor">externals.jsdoc</h1></header><article><pre class="prettyprint source lang-js"><code>/**
|
|
4
|
+
* The NPM module used to fetch URLs over HTTP(S).
|
|
5
|
+
* @external module:node-fetch
|
|
6
|
+
* @see {@link https://www.npmjs.com/package/node-fetch}
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The module used to parse HTML documents in a jQuery-like way in the NodeJS.
|
|
11
|
+
* @external module:cheerio
|
|
12
|
+
* @see {@link https://cheerio.js.org/docs/intro/}
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The templating system used to describe link templates and generaete links.
|
|
17
|
+
* @external module:mustache
|
|
18
|
+
* @see {@link https://github.com/janl/mustache.js}
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The URI (URL) parser used to parse and process link targets.
|
|
23
|
+
* @external module:urijs
|
|
24
|
+
* @see {@link https://www.npmjs.com/package/urijs}
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The module used to reverse URL slugs back to approximate page titles.
|
|
29
|
+
* @external module:url-slug
|
|
30
|
+
* @see {@link https://www.npmjs.com/package/url-slug}
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The module used for intelligent conversions to newspaper-style title-case.
|
|
35
|
+
* @external module:title-case
|
|
36
|
+
* @see {@link https://www.npmjs.com/package/title-case}
|
|
37
|
+
*/</code></pre></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><a href="/" class="sidebar-title sidebar-title-anchor">Bartificer Linkifier</a><div class="mobile-nav-links"></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.html">PageData</a></div><div class="sidebar-section-children"><a href="module-defaults.html">defaults</a></div><div class="sidebar-section-children"><a href="module-linkify.html">linkify</a></div><div class="sidebar-section-children"><a href="module-utilities.html">utilities</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.PageData.html">PageData</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-externals"><div>Externals</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-cheerio.html">cheerio</a></div><div class="sidebar-section-children"><a href="module-mustache.html">mustache</a></div><div class="sidebar-section-children"><a href="module-node-fetch.html">node-fetch</a></div><div class="sidebar-section-children"><a href="module-title-case.html">title-case</a></div><div class="sidebar-section-children"><a href="module-urijs.html">urijs</a></div><div class="sidebar-section-children"><a href="module-url-slug.html">url-slug</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|