简体   繁体   English

如何在GitBook中为Fortran启用语法突出显示

[英]How do I enable syntax highlighting for Fortran in GitBook

Original Question: 原始问题:

I can't find how to activate syntax highlighting on GitBook! 我找不到如何在GitBook上激活语法高亮显示! It works perfectly when I look at the .md files on GitHub where my repository is hosted, by not when I look at my rendered gitbook on the web. 当我查看托管我的存储库的GitHub上的.md文件时,它完美运行,而当我查看Web上呈现的gitbook时,它完美运行。 Any ideas? 有任何想法吗? Thanks 谢谢

Edit: 编辑:

it works for bash, Python, C, C++, javascript, etc, but not for Fortran! 它适用于bash,Python,C,C ++,javascript等,但不适用于Fortran! It seems that gitbook and github don't use the same syntax highlighting package. 似乎gitbook和github没有使用相同的语法突出显示包。 Is there a way to activate syntax highlighting with Fortran on GitBook? 有没有办法在GitBook上使用Fortran激活语法突出显示?

Sample code: 样例代码:

``` 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's own documentation, which is available as a GitBook , uses named fenced code blocks as popularized by GitHub : GitBook自己的文档(以GitBook的形式提供使用了 由GitHub推广的 命名的受防护代码块

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

Although I can't find any documentation that explicitly says this is supported, I suspect that it works just fine. 尽管我找不到任何明确表示支持此功能的文档,但我怀疑它可以正常工作。

Edit: 编辑:

it works for bash, Python, C, C++, javascript, etc, but not for Fortran! 它适用于bash,Python,C,C ++,javascript等,但不适用于Fortran! It seems that gitbook and github don't use the same syntax highlighting package. 似乎gitbook和github没有使用相同的语法突出显示包。

GitHub uses a Ruby library called Linguist for syntax highlighting. GitHub使用名为Linguist的Ruby库突出显示语法。 It looks like GitBook uses the JavaScript library highlight.js , which doesn't support Fortran . 看起来像GitBook使用 JavaScript库highlight.js ,它不支持Fortran语言

Is there a way to activate syntax highlighting with Fortran on GitBook? 有没有办法在GitBook上使用Fortran激活语法突出显示?

Short of contributing Fortran support to highlight.js , I don't think there's a good solution for this at the moment. 短到促进Fortran的支持的highlight.js ,我不认为有目前这种良好的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM