-
Notifications
You must be signed in to change notification settings - Fork 106
/
scrollExtensions.parsers
73 lines (72 loc) · 2.44 KB
/
scrollExtensions.parsers
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
ohayoCodeParser
extends codeParser
cueFromId
description Provide a direct link to analyze this data in Ohayo.
javascript
buildHtml() {
const link = `https://ohayo.breckyunits.com?filename=${this.root.permalink}.ohayo&data=${encodeURIComponent(this.subparticlesToString())}`
return `<div class="scrollQuote">Analyze this data yourself in <a href="${link}">Ohayo</a></div>`
}
observableParser
extends abstractScrollParser
cueFromId
atoms cueAtom urlAtom
description Provide a direct link to analyze this data in Observable.
javascript
buildHtml() {
return `<div class="scrollQuote">Analyze this data yourself in <a href="${this.getAtom(1)}">Observable</a></div>`
}
bashParser
cueFromId
description Run a bash oneliner via nodejs and dumps stdout to pre tag.
catchAllAtomType stringAtom
extends abstractScrollParser
javascript
buildHtml() {
const command = this.content
const cwd = this.root.folderPath
const output = require("child_process").execSync(command, {cwd})
return `<div class="codeWithHeader"><div class="codeHeader">${command}</div><code class="scrollCodeBlock">${output.toString().trim()}</code></div>`
}
monacoEditorParser
cueFromId
extends abstractScrollParser
description A Monaco code editor.
baseParser blobParser
example
monacoEditor javascript
// Hello world
javascript
buildHtml() {
return `<div id="monacoContainer"></div>
<script defer src="../node_modules/monaco-editor/min/vs/loader.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
require.config({ paths: { vs: '../node_modules/monaco-editor/min/vs' } })
require(["vs/editor/editor.main"], function() {
monaco.editor.create(document.getElementById('monacoContainer'), {
value: \`${this.subparticlesToString().replace(/\n/g, "\\n")}\`,
language: '${this.getAtom(1)}',
minimap: {
enabled: false
},
scrollbar: {
vertical:"hidden",
horizontal: "hidden",
handleMouseWheel:false,
},
overviewRulerLanes: 0,
hideCursorInOverviewRuler: true,
overviewRulerBorder: false,
wordWrap: 'on',
//lineNumbers: 'off',
glyphMargin: false,
folding: false,
// Undocumented see https://github.com/Microsoft/vscode/issues/30795#issuecomment-410998882
lineDecorationsWidth: 10,
lineNumbersMinChars: 2
});
});
})
</script>`
}