File tree Expand file tree Collapse file tree 5 files changed +23
-10
lines changed Expand file tree Collapse file tree 5 files changed +23
-10
lines changed Original file line number Diff line number Diff line change @@ -290,16 +290,19 @@ async def transfer_file():
290
290
291
291
if is_text :
292
292
if entry .size <= TEXT_RENDER_FILESIZE_LIMIT :
293
+ text = first_chunk .decode ('utf8' , errors = 'replace' )
294
+
293
295
# Case 1: render syntax-highlighted.
294
296
style_config = fluffy_code .prebuilt_styles .default_style ()
295
297
296
298
try :
297
299
lexer = pygments .lexers .guess_lexer_for_filename (
298
300
archive_path ,
299
- first_chunk ,
301
+ text ,
302
+ stripnl = False ,
300
303
)
301
304
except pygments .lexers .ClassNotFound :
302
- lexer = pygments .lexers .special .TextLexer ()
305
+ lexer = pygments .lexers .special .TextLexer (stripnl = False )
303
306
304
307
return templates .TemplateResponse (
305
308
'package_file_archive_path.html' ,
@@ -309,7 +312,7 @@ async def transfer_file():
309
312
'filename' : file_name ,
310
313
'archive_path' : archive_path ,
311
314
'rendered_text' : fluffy_code .code .render (
312
- first_chunk ,
315
+ text ,
313
316
style_config = style_config ,
314
317
highlight_config = fluffy_code .code .HighlightConfig (
315
318
lexer = lexer ,
Original file line number Diff line number Diff line change
1
+ html {
2
+ /* Disable smooth scrolling set by Bootstrap */
3
+ scroll-behavior : auto !important ;
4
+ }
5
+
1
6
.breadcrumb {
2
7
--bs-breadcrumb-divider : '>' ;
3
8
}
8
13
9
14
.page-package-file-archive-path .codeview {
10
15
border : solid 1px # ddd ;
16
+ font-size : 14px !important ;
17
+ }
18
+
19
+ .page-package-file-archive-path .codeview pre {
20
+ font-size : 14px ;
11
21
}
Original file line number Diff line number Diff line change @@ -40,8 +40,8 @@ <h1 class="font-monospace">{{archive_path}}</h1>
40
40
</ol >
41
41
</nav >
42
42
43
- <div class =" row" >
44
- <div class =" col" >
43
+ <div class =" row mb-6 " >
44
+ <div class =" col col-sm-9 " >
45
45
{% if cannot_render_error %}
46
46
<div class =" card" >
47
47
<div class =" card-body text-center" >
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ packages = [{include = "pypi_browser"}]
10
10
[tool .poetry .dependencies ]
11
11
python = " ^3.9"
12
12
starlette = " *"
13
- fluffy-code = " ^0.0.1 "
13
+ fluffy-code = " ^0.0.2 "
14
14
Jinja2 = " ^3.1.2"
15
15
httpx = " ^0.23.0"
16
16
aiofiles = " ^22.1.0"
You can’t perform that action at this time.
0 commit comments