Skip to content

Commit

Permalink
Maintain file formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ibevers committed Aug 20, 2024
1 parent 919c07e commit 0cb7a91
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion data/b2ai-data-preview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@
font-size: 12px;
cursor: pointer;
}

/* Preserve whitespace and formatting */
.file-content pre {
white-space: pre-wrap; /* Preserve newlines and indents */
word-wrap: break-word; /* Handle long words and prevent overflow */
background-color: #f9f9f9;
padding: 10px;
border-radius: 5px;
overflow-x: auto; /* Add horizontal scroll if needed */
}
</style>
</head>
<body>
Expand Down Expand Up @@ -98,7 +108,7 @@ <h1>GitHub Directory Viewer</h1>
// Show the file content if it's a file
if (file.type === 'file') {
const content = await fetchFileContent(file.download_url);
fileContentBox.textContent = `Contents of ${file.name}:\n\n${content}`;
fileContentBox.innerHTML = `<pre>${content}</pre>`; // Preserve formatting and whitespace
fileContentBox.style.display = 'block';
} else {
fileContentBox.style.display = 'none';
Expand Down

0 comments on commit 0cb7a91

Please sign in to comment.