Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | 117x 117x 117x | import { DateTime } from 'luxon';
import { Plugin } from '../../model/plugin';
import { Mod } from '../../model/tag';
export const codePlugin: Plugin = {
tag: 'plugin/code',
name: $localize`🗒️ Code`,
config: {
type: 'editor',
version: 1,
default: true,
add: true,
submit: $localize`🗒️ code`,
editor: true,
embeddable: true,
generated: $localize`Generated by jasper-ui ${DateTime.now().toISO()}`,
description: $localize`Uses the monaco editor (like vscode).`,
aiInstructions: `# plugin/code
The plugin/code tag indicates the Ref comment is source code. The child tag (like plugin/code/json) indicates the type.
Do not include the standard triple backticks or any extra text. The entire comment field is treated as a raw file.`,
icons: [{ label: $localize`🗒️`, order: 2 }],
filters: [
{ query: 'plugin/code', label: $localize`🗒️ code`, title: $localize`Code`, group: $localize`Media 🎬️` },
],
},
};
export function mimeToCode(mime: string) {
if (!mime) return ['plugin/code'];
switch (mime) {
case 'text/markdown':
case 'text/plain': return ['plugin/code/md'];
case 'text/vnd.qt.linguist': return ['plugin/code/typescript'];
case 'text/x-patch': return ['plugin/code/diff'];
case 'application/x-yaml': return ['plugin/code/yaml'];
case 'application/x-shellscript': return ['plugin/code/shell'];
case 'application/x-httpd-php': return ['plugin/code/php'];
case 'application/xml':
case 'application/xhtml+xml': return ['plugin/code/html'];
case 'application/json': return ['plugin/code/json'];
}
if (mime.startsWith('text/x-')) return ['plugin/code/' + mime.substring('text/x-'.length)]
if (mime.startsWith('text/')) return ['plugin/code/' + mime.substring('text/'.length)]
if (mime.startsWith('application/') && mime.endsWith('+xml')) return ['plugin/code/xml']
return [];
}
export const codeMod: Mod = {
plugin: [
codePlugin,
]
};
|