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.2.0.tar.gz (4.4 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.2.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mkdocs_timetoread_zh-0.2.0.tar.gz
  • Upload date:
  • Size: 4.4 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.2.0.tar.gz
Algorithm Hash digest
SHA256 1277057a3bbfb840fc9b7ab05c8620ebfe923df76e61da6a3301d0163ad9fc82
MD5 3f49ebb08daaf5e0403a0a3357e18191
BLAKE2b-256 34a04650c934183235e962ee74b194af368751009dac51f7778ee6dfb6fa4834

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkdocs_timetoread_zh-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3a1890c3b3a4b5e78b443f65c9bffa1fe2bb578a4afd81469eb9a7f503d8853d
MD5 88fbeb2379c32fcf6242e3b12194cac3
BLAKE2b-256 54062edc378de6209da9ace37b3d4a30f959b9300070b1abcb42cb87c029d8f2

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