docsify-updated

1.0.5 • Public • Published

docsify-updated

npm NPM

Add update time for each of your docsify markdown

install

add js CDN to index.html

<script src="https://cdn.jsdelivr.net/npm/docsify-updated/src/time-updater.min.js"></script>

or

<script src="https://cdn.jsdelivr.net/npm/docsify-updated/src/time-updater.js"></script>

usage

Add javasript to index.html, and you can modify the content of the text field arbitrarily

window.$docsify = {
  timeUpdater: {
    text: ">last update time: {docsify-updated}",
    formatUpdated: "{YYYY}/{MM}/{DD}",
    whereToPlace: "bottom",  // "top" or "bottom", default to "bottom"
  },
};

or

window.$docsify = {
  timeUpdater: {
    text: ">最后更新时间: {docsify-updated}",
    formatUpdated: "{YYYY}/{MM}/{DD}",
    whereToPlace: "bottom",  // "top" or "bottom", default to "bottom"
  },
};

time patterns

please see https://github.com/lukeed/tinydate#patterns

  • {YYYY}: full year; eg: 2017
  • {YY}: short year; eg: 17
  • {MM}: month; eg: 04
  • {DD}: day; eg: 01
  • {HH}: hours; eg: 06 (24h)
  • {mm}: minutes; eg: 59
  • {ss}: seconds; eg: 09
  • {fff}: milliseconds; eg: 555

nested

modify timeUpdater.text to nest HTML

window.$docsify = {
  timeUpdater: {
    text: "<div align='center'>last update time: {docsify-updated}</div>",
    formatUpdated: "{YYYY}/{MM}/{DD}",
  },
};

demo1

or

window.$docsify = {
  timeUpdater: {
    text: "<div align='center' width='200px' style='color:gray;font-size:10px'>-------------- 最后更新时间:&emsp;{docsify-updated} --------------</div>",
    formatUpdated: "{YYYY} 年 {MM} 月 {DD} 日",
  },
};

demo1

location

choose where to place it by timeUpdater.whereToPlace

window.$docsify = {
  timeUpdater: {
    text: ">Last Modify: {docsify-updated}",
    formatUpdated: "{YYYY}/{MM}/{DD}",
    whereToPlace: "top"  // "top" or "bottom", default to "bottom"
  },
};

demo1

demo

demo: english

window.$docsify = {
  timeUpdater: {
    text: ">Last Modify: {docsify-updated}",
    formatUpdated: "{YYYY}/{MM}/{DD}",
  },
};

demo1

demo: chinese

window.$docsify = {
  timeUpdater: {
    text: ">最后更新时间: {docsify-updated}",
    formatUpdated: "{YYYY}/{MM}/{DD}",
  },
};

demo2

demo: another style

window.$docsify = {
  timeUpdater: {
    text: "---\nlast update time: {docsify-updated}",
    formatUpdated: "{YYYY}/{MM}/{DD}",
  },
};

demo3

Package Sidebar

Install

npm i docsify-updated

Weekly Downloads

15

Version

1.0.5

License

MIT

Unpacked Size

68.7 kB

Total Files

11

Last publish

Collaborators

  • pfeak