Skip to main content

Estimated Time To Read generator for MkDocs with multiple language support

Project description

mkdocs-timetoread-zh

mkdocs-timetoread-zh is a fork of @ntt4's mkdocs-timetoread-plugin with multiple language support.

Setup

Install the plugin using pip:

pip install mkdocs-timetoread-zh

Activate the plugin in mkdocs.yml:

plugins:
  - search
  - timetoread-zh

Note: If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry set, but now you have to enable it explicitly.

mkdocs.yml Configuration

  • wpm - Sets the 'words per minute' value for calculating estimated read time.

    • Default value is 255
    • Possible value range: 1 - 999
  • language - Sets the language for the reading time message.

    • Default value is en
    • Possible values: en, zh
  • textColor - Sets the CSS color for styling the 'Estimated read time:' text.

    • Default value is bdbdbd
    • Possible value range: 000000 - ffffff
  • template - Sets the template for the reading time message.

    • Default value is Estimated read time: {minutes} minutes
    • Possible values: Estimated read time: {minutes} minutes, 预计阅读时长: {minutes} 分钟
  • min_time - Sets the minimum time for the reading time message to be displayed.

    • Default value is 1
    • Possible value range: 1 - 999 (minutes)
  • round_method - Sets the method for rounding the reading time.

    • Default value is ceil
    • Possible values: ceil, floor, round
  • allPages - Sets all markdown files to have their read times' calculated unless explicitly disabled in the files' Front Matter.

    • Default value is True
    • Possible values: True or False

Example Configuration

plugins:
  - timetoread-zh:
      wpm: 300
      language: "zh"
      textColor: "666666"
      template: "阅读时间:{minutes}分钟"
      min_time: 1
      round_method: "ceil"

Front Matter

Other configuration options are available by defining the following in a YAML front matter block in each markdown file.

# Disable timetoread on a per file basis if `allPages` is set to True
timetoread: False
# Enable timetoread on a per file basis if `allPages` is set to False
timetoread: True

Usage

Once activated mkdocs-timetoread-zh will automatically add a new line, with the estimated time to read the document, after the </h1> tag in the HTML output generated by MkDocs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_timetoread_zh-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_timetoread_zh-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_timetoread_zh-0.1.0.tar.gz.

File metadata

  • Download URL: mkdocs_timetoread_zh-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Darwin/23.6.0

File hashes

Hashes for mkdocs_timetoread_zh-0.1.0.tar.gz
Algorithm Hash digest
SHA256 93d8e4ab44680dab05b26ceca698ccb6c6ffe2ab46109fe9884b85254672b307
MD5 3130ea64a652470896c9f9c718e08032
BLAKE2b-256 f1a5e0caed6278257ddfbf4c3cb512932670f68046ccdd2555a3a170eeb4f1ce

See more details on using hashes here.

File details

Details for the file mkdocs_timetoread_zh-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_timetoread_zh-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 362a7e787ffff5e47f5cccd2bab1854c5d49fcf4b49a3386b8831198e1e051e4
MD5 e0253c33a061d953b5e0a5e5f88a0c0b
BLAKE2b-256 cd59e7cabf52a9f0e711a60b909a5d5fe75255d6db48610b27140ff414e36e42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page