I have written the settings for the markdown file that the table of content code is the following.
<!-- TOC depthFrom:2 -->
- [LeetCode](#leetcode)
- [Problems](#problems)
- [Algorithms](#algorithms)
- [License](#license)
<!-- /TOC -->
However, the depthFrom property doesn't work with "Update on save". I have updated it manually and it can generate the right table of content, but after I pressed the Ctrl + s keys, the table of content would be automatically updated to the former version(with heading 1).