sanwen的博客
  • Home
  • Categories
  • Tags
  • Archives

Pelican插件用法

Contents

  • 安装Pelican插件
  • 使用Pelican插件
    • extract_toc

安装Pelican插件¶

下载Pelican插件,放在pelican-plugins目录中。

git clone https://github.com/getpelican/pelican-plugins

配置pelicanconf.py文件

PLUGIN_PATHS = ['path/to/pelican-plugins']  # 插件的目录  
PLUGINS = ['assets', 'sitemap', 'gravatar'] # 启用的插件列表

使用Pelican插件¶

extract_toc¶

extract_toc插件需要BeautifulSoup的支持

pip install beautifulsoup4

一、针对markdown编写的博客

首先需要在配置文件里面设置

MD_EXTENSIONS = (['toc'])

然后在markdown文件(.md)的开头处添加[TOC]标记。如下所示

title: My super title
date: 4-4-2013
tags: thats, awesome

[TOC]

# Heading 1 #

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.

  • « 动态规划在字符串上的应用
  • Pelican的迁移和快速开始 »

Published

8月 19, 2014

Category

建站
  • Powered by Pelican. Theme: Elegant by Talha Mansoor