fix multiple lines output and color scheme

This commit is contained in:
Xuan Son Nguyen 2025-02-08 15:16:26 +01:00
parent 19a95daf78
commit 22e826336a
3 changed files with 12 additions and 4 deletions

Binary file not shown.

View file

@ -36,7 +36,7 @@ const PyodideWrapper = {
if (result) { if (result) {
stdOutAndErr.push(result.toString()); stdOutAndErr.push(result.toString());
} }
return stdOutAndErr.join(''); return stdOutAndErr.join('\n');
}, },
}; };
@ -102,9 +102,11 @@ export default function CanvasPyInterpreter() {
{running ? 'Running...' : 'Run'} {running ? 'Running...' : 'Run'}
</button> </button>
</div> </div>
<pre className="bg-slate-900 rounded-md grow text-gray-200 p-3 whitespace-pre-wrap overflow-auto"> <textarea
{output} className="textarea textarea-bordered h-full dark-color"
</pre> value={output}
readOnly
></textarea>
</div> </div>
</div> </div>
</div> </div>

View file

@ -45,6 +45,9 @@
/* Highlight.js */ /* Highlight.js */
[data-color-scheme='light'] { [data-color-scheme='light'] {
@include meta.load-css('highlight.js/styles/stackoverflow-light'); @include meta.load-css('highlight.js/styles/stackoverflow-light');
.dark-color {
@apply bg-base-content text-base-100;
}
} }
[data-color-scheme='dark'] { [data-color-scheme='dark'] {
@include meta.load-css('highlight.js/styles/stackoverflow-dark'); @include meta.load-css('highlight.js/styles/stackoverflow-dark');
@ -52,6 +55,9 @@
[data-color-scheme='auto'] { [data-color-scheme='auto'] {
@media (prefers-color-scheme: light) { @media (prefers-color-scheme: light) {
@include meta.load-css('highlight.js/styles/stackoverflow-light'); @include meta.load-css('highlight.js/styles/stackoverflow-light');
.dark-color {
@apply bg-base-content text-base-100;
}
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
@include meta.load-css('highlight.js/styles/stackoverflow-dark'); @include meta.load-css('highlight.js/styles/stackoverflow-dark');