rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
18.11k stars 1.63k forks source link

Can't display code #2153

Closed ovo-Tim closed 1 year ago

ovo-Tim commented 1 year ago

Question

On FireFox: 图片

On edge: 图片

Version

mdbook v0.4.32
ehuss commented 1 year ago

This looks like the ace editor didn't load. Can you check your browser's console for any errors, or try refreshing? cc @mgeisler in case this is something specific to your theme.

ovo-Tim commented 1 year ago

Can you check your browser's console for any errors 图片

mgeisler commented 1 year ago

Thanks @ehuss for the ping! @ovo-Tim, this issue looks like https://github.com/google/comprehensive-rust/issues/733 — the solution is to enable symlinks in Git on Windows with

git config --global core.symlinks true

This is (briefly) mentioned in our README.

ovo-Tim commented 1 year ago

Thanks @ehuss for the ping! @ovo-Tim, this issue looks like google/comprehensive-rust#733 — the solution is to enable symlinks in Git on Windows with

git config --global core.symlinks true

This is (briefly) mentioned in our README.

But I am using arch linux.

❯ neofetch
                   -`                    tim@TimTu-Arch 
                  .o+`                   -------------- 
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Host: Code01 Ver2.0 1 
               `+oooooo:                 Kernel: 6.4.8-arch1-1 
               -+oooooo+:                Uptime: 4 days, 22 mins 
             `/:-:++oooo+:               Packages: 1220 (pacman) 
            `/++++/+++++++:              Shell: bash 5.1.16 
           `/++++++++++++++:             Resolution: 2560x1600 
          `/+++ooooooooooooo/`           DE: Plasma 5.27.7 
         ./ooosssso++osssssso+`          WM: kwin 
        .oossssso-````/ossssss+`         Theme: NephriteLight [Plasma], Breeze [GTK2/3] 
       -osssssso.      :ssssssso.        Icons: [Plasma], Colloid [GTK2/3] 
      :osssssss/        osssso+++.       Terminal: konsole 
     /ossssssss/        +ssssooo/-       Terminal Font: Hack [SRC] 10 
   `/ossssso+/:-        -:/+osssso+-     CPU: AMD Ryzen 7 6800H with Radeon Graphics (16) @ 3.200GHz 
  `+sso+:-`                 `.-/+oso:    GPU: AMD ATI Radeon 680M 
 `++:.                           `-/+/   Memory: 17725MiB / 30808MiB 
 .`                                 `/

It did,'t solve my problem.

mgeisler commented 1 year ago

Okay, can you check that theme/book.js is symlink pointing to ../third_party/mdbook/book.js?

It looks like this in my working copy:

% ls -l theme/book.js
lrwxrwxrwx 1 mgeisler group 29 May  4 11:30 theme/book.js -> ../third_party/mdbook/book.js

How did you get hold of the course files? Via a git clone or via some other mechanism?

ovo-Tim commented 1 year ago

I may know the problem. I just download the zip file from github. As far as I know, zip can't support symlink well. I will have a try after two days. Thanks you.

mgeisler commented 1 year ago

Thanks for explaining @ovo-Tim, you're exactly right: the zip files generated by GitHub don't work since they don't preserve the symlinks we use. I think we should close this issue — it's not a problem with mdbook.