diff options
author | 2025-01-07 12:36:05 +0800 | |
---|---|---|
committer | 2025-01-07 12:36:05 +0800 | |
commit | 4d88ef666eee1b6f191f6e85b00acf8d5a2d1899 (patch) | |
tree | 68391846bae84f9546b0d089c012afc336a6e6bd /code/linux/httpmyserver.md | |
parent | 11e64c5804b696f170b9d5d881befbabc4a4e85c (diff) | |
download | myweb-new_highlightjs.tar.gz myweb-new_highlightjs.zip |
highlight don't use auto-detect but given languagenew_highlightjs
In this commit, lot's of things is changed. Hope they all runs
currectly.
Now highlight.js is supporting more and more proguam languages, but
the auto detection always go wrong, even for common languages like c,
bash, python, makefile.
Use Given Language
------------------
As you know, I always write markdown and convert to html by pandoc. In
the old, "```cpp" in markdown will be deleted first to keep the embeded
code clean and not highlighted, then I can use highlight.js. But this
causes that html document doesn't know the language.
This time, md2html.sh is changed: pandoc use "--no-highlight"
argument to keep code clean, and it will output like this:
```html
<pre class="cpp"><code>...</code></pre>
```
Although there may be other tags between `<code></code>`, it's clear
that `<pre class="xxx"><code>` is nested tightly, except some space
characters or \n.
Then, sed deal with the whole doc(not line by line), replace `<pre
class="xxx"><code>` with `<pre><code class="language-xxx">`. That's it!
Math Formula
------------
Math formular is also a problem during convertion by pandoc. In the old
it's dealed menually. Now pandoc use "--mathjax=none", then formula is
no longer showed by pandoc, but only `<span class="math xxx">\( formula \)</span>`.
And the math tool I used will deal with it.
Mermaid picture
----------------
pandoc doesn't support convert mermaid in markdown to html picture.
Let's have a warning!
Diffstat (limited to 'code/linux/httpmyserver.md')
-rw-r--r-- | code/linux/httpmyserver.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/code/linux/httpmyserver.md b/code/linux/httpmyserver.md index 2f9f621..b39b266 100644 --- a/code/linux/httpmyserver.md +++ b/code/linux/httpmyserver.md | |||
@@ -5,11 +5,11 @@ | |||
5 | - 能让我们自己点进(或退出)层层文件夹,展示当前文件夹下的所有文件/文件夹 | 5 | - 能让我们自己点进(或退出)层层文件夹,展示当前文件夹下的所有文件/文件夹 |
6 | - 点击文件,能够看到文件内容 | 6 | - 点击文件,能够看到文件内容 |
7 | 7 | ||
8 |  | 8 |  |
9 | 9 | ||
10 | 点击进入文件`nginx.txt`,我们要求看到文件的内容: | 10 | 点击进入文件`nginx.txt`,我们要求看到文件的内容: |
11 | 11 | ||
12 |  | 12 |  |
13 | 13 | ||
14 | 既要看文件内容,又要能浏览不同的文件夹。这个功能如果直接用程序或 nginx 实现似乎有些新手不友好。没事,python3 为我们提供了这个功能,脚本为`/usr/lib/python3.x/http/server.py`。使用时执行以下命令即可: | 14 | 既要看文件内容,又要能浏览不同的文件夹。这个功能如果直接用程序或 nginx 实现似乎有些新手不友好。没事,python3 为我们提供了这个功能,脚本为`/usr/lib/python3.x/http/server.py`。使用时执行以下命令即可: |
15 | 15 | ||