| term-to-html --theme dark
30 | ```
31 |
32 | ### Use as a module
33 |
34 | ```js
35 | const termToHtml = require('term-to-html')
36 | const html = termToHtml.strings(stringWithAnsi, termToHtml.themes.dark.name)
37 | ```
38 |
39 | ## Testing
40 |
41 | There are [E2E tests](e2e.js) and you can observe the output by running
42 |
43 | ```shell
44 | FORCE_COLOR=2 npx mocha spec.js --reporter spec | ./bin/term-to-html.js
45 | ```
46 |
47 | ### Small print
48 |
49 | Author: Gleb Bahmutov <gleb.bahmutov@gmail.com> © 2020
50 |
51 | - [@bahmutov](https://twitter.com/bahmutov)
52 | - [glebbahmutov.com](https://glebbahmutov.com)
53 | - [blog](https://glebbahmutov.com/blog)
54 |
55 | License: MIT - do anything with the code, but don't blame me if it does not work.
56 |
57 | Support: if you find any problems with this module, email / tweet /
58 | [open issue](https://github.com/bahmutov/term-to-html/issues) on Github
59 |
60 | ## MIT License
61 |
62 | Copyright (c) 2020 Gleb Bahmutov <gleb.bahmutov@gmail.com>
63 |
64 | Permission is hereby granted, free of charge, to any person
65 | obtaining a copy of this software and associated documentation
66 | files (the "Software"), to deal in the Software without
67 | restriction, including without limitation the rights to use,
68 | copy, modify, merge, publish, distribute, sublicense, and/or sell
69 | copies of the Software, and to permit persons to whom the
70 | Software is furnished to do so, subject to the following
71 | conditions:
72 |
73 | The above copyright notice and this permission notice shall be
74 | included in all copies or substantial portions of the Software.
75 |
76 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
77 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
78 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
79 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
80 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
81 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
82 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
83 | OTHER DEALINGS IN THE SOFTWARE.
84 |
85 | [npm-icon]: https://nodei.co/npm/term-to-html.svg?downloads=true
86 | [npm-url]: https://npmjs.org/package/term-to-html
87 | [renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg
88 | [renovate-app]: https://renovateapp.com/
89 |
--------------------------------------------------------------------------------
/__snapshots__/e2e.js:
--------------------------------------------------------------------------------
1 | exports['generated html'] = `
2 |
3 |
4 |
5 |
6 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | example
27 | ✓ works A (1000ms)
28 | ✓ works B (1000ms)
29 | ✓ works C (1000ms)
30 | - skips D
31 | hello <there>!
32 | ✓ has brackets < and >
33 | ┌────────────────────┬────────────────────┐
34 | │ TH 1 label │ TH 2 label │
35 | ├────────────────────┼────────────────────┤
36 | │ First value │ Second value │
37 | ├────────────────────┼────────────────────┤
38 | │ First value │ Second value │
39 | └────────────────────┴────────────────────┘
40 | ✓ has a table
41 |
42 |
43 | 5 passing (3s)
44 | 1 pending
45 |
46 |
47 |
48 | `
49 |
50 | exports['html with dark theme'] = `
51 |
52 |
53 |
54 |
55 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | example
76 | ✓ works A (1000ms)
77 | ✓ works B (1000ms)
78 | ✓ works C (1000ms)
79 | - skips D
80 | hello <there>!
81 | ✓ has brackets < and >
82 | ┌────────────────────┬────────────────────┐
83 | │ TH 1 label │ TH 2 label │
84 | ├────────────────────┼────────────────────┤
85 | │ First value │ Second value │
86 | ├────────────────────┼────────────────────┤
87 | │ First value │ Second value │
88 | └────────────────────┴────────────────────┘
89 | ✓ has a table
90 |
91 |
92 | 5 passing (3s)
93 | 1 pending
94 |
95 |
96 |
97 | `
98 |
99 | exports['string to string dark theme'] = `
100 |
101 |
102 |
103 |
104 |
118 |
119 | red cyan
120 | second line
121 |
122 | `
123 |
124 | exports['themes'] = {
125 | "light": {
126 | "newline": false,
127 | "bg": "#fff",
128 | "fg": "#111",
129 | "name": "light"
130 | },
131 | "dark": {
132 | "newline": false,
133 | "bg": "#000",
134 | "fg": "#eee",
135 | "name": "dark"
136 | }
137 | }
138 |
--------------------------------------------------------------------------------