如何在 GitBook 中为 Fortran 启用语法高亮显示

How do I enable syntax highlighting for Fortran in GitBook

原问题:

我在 GitBook 上找不到如何激活语法高亮! 当我查看托管我的存储库的 GitHub 上的 .md 文件时,它工作得很好,而不是当我在网络上查看我渲染的 gitbook 时。 有任何想法吗?谢谢

编辑:

它适用于 bash、Python、C、C++、javascript 等,但不适用于 Fortran!似乎 gitbook 和 github 没有使用相同的语法高亮包。 有没有办法在 GitBook 上使用 Fortran 激活语法突出显示?

示例代码:

``` fortran
program compute_t
    implicit none

    integer :: d1, d2, d3, d4 d5  ! Input data
    integer :: u1, u2, v, w, t    ! Computed entities

    call read_data(d1,d2,d3,d4,d5)

    call compute_u(d1,d2,u1)
    call compute_u(d3,d4,u2)
    call compute_w(d5,w)
    call compute_v(u2,w,v)
    call compute_t(u1,v,t)

    write(*,*), "t=", t

end program
```

GitBook自带的文档,也就是available as a GitBook, uses named fenced code blocks as popularized by GitHub:

```markdown
# H1
## H2
### H3
#### H4
##### H5
###### H6
```

虽然我找不到任何明确说明支持此功能的文档,但我怀疑它工作得很好。

编辑:

it works for bash, Python, C, C++, javascript, etc, but not for Fortran! It seems that gitbook and github don't use the same syntax highlighting package.

GitHub 使用名为 Linguist for syntax highlighting. It looks like GitBook uses the JavaScript library highlight.js, which doesn't support Fortran.

的 Ruby 库

Is there a way to activate syntax highlighting with Fortran on GitBook?

缺少对 highlight.js 的 Fortran 支持,我认为目前没有好的解决方案。