Skip to content

Commit

Permalink
chore: update highlight function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay-Karia committed Aug 11, 2024
1 parent ff19045 commit e526a7f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions dist/npm-to-yarn.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -693,16 +693,16 @@ function convert(str, to) {
function highlight(command, theme) {
if (theme === void 0) { theme = 'light'; }
return __awaiter(this, void 0, void 0, function () {
var html;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, codeToHtml(command, {
lang: 'shell',
theme: "github-".concat(theme)
}).then(function (html) {
console.log(html);
})];
case 1:
html = _a.sent();
console.log(html);
_a.sent();
return [2 /*return*/];
}
});
Expand Down
2 changes: 1 addition & 1 deletion dist/npm-to-yarn.mjs.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/npm-to-yarn.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/npm-to-yarn.umd.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/types/highlight.d.ts

This file was deleted.

8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { npmToYarn } from './npmToYarn'
import { npmToPnpm } from './npmToPnpm'
import { npmToBun } from './npmToBun'

import {codeToHtml} from 'shiki';
import { codeToHtml } from 'shiki'

/**
* Converts between npm and yarn command
Expand All @@ -24,10 +24,10 @@ export function convert (str: string, to: 'npm' | 'yarn' | 'pnpm' | 'bun'): stri
* Returns highlighted html string
*/
export async function highlight (command: string, theme: 'light' | 'dark' = 'light') {
const html = await codeToHtml(command, {
await codeToHtml(command, {
lang: 'shell',
theme: `github-${theme}`
}).then((html) => {
console.log(html)
})

console.log(html)
}

0 comments on commit e526a7f

Please sign in to comment.