-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (24 loc) · 899 Bytes
/
Copy pathindex.js
File metadata and controls
27 lines (24 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'use strict'
const { buildTag } = require('./build-tag.js')
/**
* DeskCrew Docusaurus plugin.
*
* Adds the DeskCrew support widget (live chat, instant answers and a help
* centre) to every page. It appends a single `<script src="…/desk.js">` tag via
* the `injectHtmlTags` lifecycle (`postBodyTags`); desk.js reads its `data-*`
* attributes and derives its API origin from its own src.
*
* @param {unknown} _context Docusaurus LoadContext (unused).
* @param {Record<string, unknown>} [options]
* @returns {{ name: string, injectHtmlTags: () => { postBodyTags?: string[] } }}
*/
module.exports = function deskcrewPlugin(_context, options) {
const { tag, warnings } = buildTag(options || {})
for (const message of warnings) console.warn(message)
return {
name: 'docusaurus-plugin-deskcrew',
injectHtmlTags() {
return tag ? { postBodyTags: [tag] } : {}
},
}
}