Skip to content

Extract CSS from your local Typora installation

Pegasis edited this page Oct 15, 2021 · 2 revisions

Directly use the CSS from the Typora themes folder won't work because Typora does additional processing on top of that file and dynamically adds css related to code highlighting and LaTeX.

Distributing CSS from Typora with an open source package is probably not a very good idea.

Hence this guide:

  1. Create a new document using Typora.
  2. Include one fenced code block and one inline math using the following markdown:
    ```
    c
    ```
    
    $\lambda$
    
  3. Click on File > Export > HTML
  4. Open the exported html file
  5. Find the first line starting with <link or <style, in this example, line 6 starts with <link, remember this place.
  6. Find the last </style> before <title>, usually at the very bottom of the file.
  7. Copy everything in between. (including leading <link and trailing </style>)
  8. Paste it to a new file, in this example, we will name it tags.txt.
  9. Use it with command line flag -g tags.txt or RenderOptions extraHeadTags: tags to get that Typora style in your export!
Clone this wiki locally