More work on presentation + improves auto images
Added more slides Auto graphics now work for xkcd and ansi shell output
This commit is contained in:
parent
b128151e39
commit
2712cddb60
5 changed files with 283 additions and 19 deletions
82
bin/ansi2svg
Executable file
82
bin/ansi2svg
Executable file
|
@ -0,0 +1,82 @@
|
|||
#!/usr/bin/env node
|
||||
// Relies on this being installed: https://github.com/F1LT3R/ansi-to-svg
|
||||
const {stdin} = process;
|
||||
|
||||
const ansiToSVG = require('ansi-to-svg')
|
||||
|
||||
getStdin = async () => {
|
||||
let result = '';
|
||||
|
||||
if (stdin.isTTY) {
|
||||
return result;
|
||||
}
|
||||
|
||||
stdin.setEncoding('utf8');
|
||||
|
||||
for await (const chunk of stdin) {
|
||||
result += chunk;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
(async () => {
|
||||
// Returns an SVG string
|
||||
console.log(ansiToSVG(await getStdin(), {
|
||||
// Defaults to 2x for Retina compatibility
|
||||
scale: 2,
|
||||
|
||||
// Font settings
|
||||
fontFace: 'Courier',
|
||||
fontSize: 14,
|
||||
lineHeight: 18,
|
||||
|
||||
// Padding
|
||||
paddingTop: 5,
|
||||
paddingLeft: 5,
|
||||
paddingBottom: 5,
|
||||
paddingRight: 5,
|
||||
|
||||
// Supply an iTerm2 Color file
|
||||
colors: './base16-flat-dark-f1lt3r-256.itermcolors',
|
||||
|
||||
// Or override the default colors
|
||||
// (all defaults shown here)
|
||||
colors: {
|
||||
black: '#000000',
|
||||
red: '#B22222',
|
||||
green: '#32CD32',
|
||||
yellow: '#DAA520',
|
||||
blue: '#4169E1',
|
||||
magenta: '#9932CC',
|
||||
cyan: '#008B8B',
|
||||
white: '#D3D3D3',
|
||||
gray: '#A9A9A9',
|
||||
redBright: '#FF4500',
|
||||
greenBright: '#ADFF2F',
|
||||
yellowBright: '#FFFF00',
|
||||
blueBright: '#87CEEB',
|
||||
magentaBright: '#FF00FF',
|
||||
cyanBright: '#00FFFF',
|
||||
whiteBright: '#FFFFFF',
|
||||
bgBlack: '#000000',
|
||||
bgRed: '#B22222',
|
||||
bgGreen: '#32CD32',
|
||||
bgYellow: '#DAA520',
|
||||
bgBlue: '#4169E1',
|
||||
bgMagenta: '#9932CC',
|
||||
bgCyan: '#008B8B',
|
||||
bgWhite: '#D3D3D3',
|
||||
bgGray: '#A9A9A9',
|
||||
bgRedBright: '#FF0000',
|
||||
bgGreenBright: '#ADFF2F',
|
||||
bgYellowBright: '#FFFF00',
|
||||
bgBlueBright: '#87CEEB',
|
||||
bgMagentaBright: '#FF00FF',
|
||||
bgCyanBright: '#00FFFF',
|
||||
bgWhiteBright: '#FFFFFF',
|
||||
backgroundColor: '#000000',
|
||||
foregroundColor: '#D3D3D3'
|
||||
}
|
||||
}))
|
||||
})();
|
|
@ -3,4 +3,4 @@ grep -o '\\includegraphics.*\}' main.latex |
|
|||
cut -d'{' -f2 |
|
||||
cut -d'}' -f 1 |
|
||||
grep '^auto-' |
|
||||
awk '{print "./auto-images/" $1 ".png"}'
|
||||
awk '{print "./auto-images/" $1}'
|
Loading…
Add table
Add a link
Reference in a new issue