# Typora:跨平臺的 Markdown 編輯器 > 作者:王一哲 > 日期:2020/4/7 ## 前言 之前的介紹了簡單的〈[Notepad++ 及 Markdown 外掛](https://hackmd.io/@yizhewang/Hk2S0VVDI)〉,但是這個方法對於數學式子和程式碼高亮度語法的效果較差,這次介紹效果較好的跨平臺 Markdown 編輯器:Typora。 <br /> ## 下載及安裝 Typora Typora 網站上提供了 Windows、OS X、Linux 三種平臺的版本,以下是 Windows 以及 Linux 版的安裝方法。 <img style="display: block; margin-left: auto; margin-right: auto" height="100%" width="100%" src="https://imgur.com/ttY6B5L.png"> <div style="text-align:center">Typora 下載頁面</div> <br /> ### Windows 下載對應的版本,分為[64位元](https://typora.io/windows/typora-setup-x64.exe?)以及為[32位元](https://typora.io/windows/typora-setup-ia32.exe?)。下載完畢之後在安裝檔上按滑鼠右鍵,點選**以系統管理員身份執行**,接著只要一直按**下一步**即可。下圖是 Typora Windows 版預設模式的畫面。 <br /> <img style="display: block; margin-left: auto; margin-right: auto" height="100%" width="100%" src="https://imgur.com/IHad6KS.png"> <div style="text-align:center">Typora Windows 版預設模式</div> <br /> ### Linux 測試版本為 Lubuntu 19.04,按照官網上的指示使用以下的指令安裝 ```shell= wget -qO - https://typora.io/linux/public-key.asc | sudo apt-key add - sudo add-apt-repository 'deb https://typora.io/linux ./' sudo apt-get update sudo apt-get install typora ``` <br /> <img style="display: block; margin-left: auto; margin-right: auto" height="100%" width="100%" src="https://imgur.com/mEoEFL8.png"> <div style="text-align:center">Typora Linux 版預設模式</div> <br /> ## 數學式子測試 若要顯示獨立為一個段落並且置中的數學式子,可以用兩組 \$$ 將數學式子的 $\LaTeX$ 包在裡面,以馬克士威方程式為例,需要輸入以下的編碼 ```latex= $$\nabla \cdot \mathbf{E} = \frac{\rho}{\varepsilon_0}$$ $$\nabla \cdot \mathbf{B} = 0$$ $$\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}$$ $$\nabla \times \mathbf{B} = \mu_0 \left ( \mathbf{J} + \varepsilon_0 \frac{\partial \mathbf{E}}{\partial t} \right )$$ ``` <br /> 理論上會看到以下的數學式子 $$\nabla \cdot \mathbf{E} = \frac{\rho}{\varepsilon_0}$$ $$\nabla \cdot \mathbf{B} = 0$$ $$\nabla \times \mathbf{E} = - \frac{\partial \mathbf{B}}{\partial t}$$ $$\nabla \times \mathbf{B} = \mu_0 \left ( \mathbf{J} + \varepsilon_0 \frac{\partial \mathbf{E}}{\partial t} \right )$$ 但實際上無法順利顯示,需要調整**偏好設定**。 <br /> <img style="display: block; margin-left: auto; margin-right: auto" height="100%" width="100%" src="https://imgur.com/LiR7tUW.png"> <div style="text-align:center">數學式子測試</div> <br /> 從選單依序點選**檔案** ⇒ **偏好設定**或按快速鍵 **Ctrl + ,**,點選左側最下方的 **Markdown**,將 **Markdown 語法擴充支援行內數學式**選項打勾,重新啟動 Typora 之後應該就能顯示數學式子。 <br /> <img style="display: block; margin-left: auto; margin-right: auto" height="40%" width="40%" src="https://imgur.com/YRpjVYV.png"> <div style="text-align:center">檔案 ⇒ 偏好設定</div> <br /> <img style="display: block; margin-left: auto; margin-right: auto" height="100%" width="100%" src="https://imgur.com/rmveHzv.png"> <div style="text-align:center">Markdown 偏好設定(Markdown 語法擴充支援)</div> <br /> <img style="display: block; margin-left: auto; margin-right: auto" height="100%" width="100%" src="https://imgur.com/24E8Syq.png"> <div style="text-align:center">數學式子測試2</div> <br /> ## 程式碼高亮度語法測試 Markdown 支援相當多種的程式碼高亮度語法,例如 Python、C、C++、Shell……等等,以 Python 程式碼為例,在程式碼區段開頭用 \`\`\`python 標記,程式碼區段結尾再加上 \`\`\`,就能夠插入程式碼區段。從選單依序點選**檔案** ⇒ **偏好設定**或按快速鍵 **Ctrl + ,**,點選左側最下方的 **Markdown**,將 **程式碼區塊**選項都打勾,重新啟動 Typora 之後應該就能顯示帶有行號的程式碼。 <br /> <img style="display: block; margin-left: auto; margin-right: auto" height="100%" width="100%" src="https://imgur.com/ouYY0tu.png"> <div style="text-align:center">Markdown 偏好設定(程式碼區塊)</div> <br /> 以下是使用 Python 印出九九乘法表的程式碼,下圖是測試結果。 ```python= for i in range(2, 10, 1): for j in range(2, 10, 1): print("{:d} * {:d} = {:d}".format(i, j, i*j), end='\t') print('') ``` <br /> <img style="display: block; margin-left: auto; margin-right: auto" height="100%" width="100%" src="https://imgur.com/dAGRCl1.png"> <div style="text-align:center">程式碼高亮度語法測試</div> <br /> ## 匯出檔案 Typora 支援相當多種匯出的檔案格式,這是 Typora 比較強大的地方。 <img style="display: block; margin-left: auto; margin-right: auto" height="60%" width="60%" src="https://imgur.com/mypxWNP.png"> <div style="text-align:center">匯出檔案</div> <br /> ## 結語 Typora 很適合 Markdown 的重度使用者,而且還有許多可以調整的細節,例如更換主題、字體……等等,有興趣的同學可以上網搜尋相關的文章。 <br /> --- ###### tags:`電腦`