Home

Awesome

obsidian Timelines

GitHub release) GitHub all releases

Generate a chronological timeline of all notes with the specified set of tags.

Example - Vertical Timeline

example

Example - Horizantal Timeline

example

Inserting a Timeline

VIDEO BRIEF EXAMPLE: https://www.youtube.com/watch?v=_gtpZDXWcrM

To render a timeline in a note:

  1. Add the timeline tag to the note, either in the YAML frontmatter or somewhere else.
  2. Create a timeline code block or a timeline HTML comment for static rendering.

Using a Timeline code block for dynamic rendering

Create the following code block where a timeline is to be inserted:

example

You can also have an horizontal timeline by:

  1. Replacing timeline with timeline-vis in the code block,
  2. Add bellow filters:
tags=test
startDate=1700
endDate=2030
fivHeight=600
minDate=200

The render block takes a single input which is the list of tags by which to filter timeline tagged notes (e.g. in the above example block, ONLY notes with all three tags timeline, test and now).

Using an HTML code block for static rendering

Insert the following HTML comment where a statically rendered timeline should be inserted:

<!--TIMELINE BEGIN tags='test;now'--><!--TIMELINE END-->

Use the Timelines: Render Timeline command to generate a timeline statically. Running the command again will replace everything between the two comments (BEGIN/END) with a freshly rendered timeline.

Timeline event changes will not be detected using this method, but as it is creating static HTML, the generated content will work be readable without Obsidian (on GitHub, via Obsidian publish, etc.).

Timeline Tagging a note

For a note to be included in a timeline the following must be valid:

  1. The timeline tag must be included in that note
---
tags: [timeline, test, me, now]
---
  1. The note must have all the specified tags to be included in the search. This note example above will be included in all of the following searches (assuming its timeline span info is valid): test, test;me, test;me;now, etc.

  2. The note must contain at least one timeline span or div element containing the event information, see the next section.

When generating a timeline, a note will be ignored in the following cases:

Timeline Event Properties

Timeline events must specify the following:

All other fields are optional.

Invalid timeline events will be skipped.

Timeline Entry

A timeline entry can be created using a <span></span> or <div></div> tag, with the following attributes:

<span 
	  class='ob-timelines' 
	  data-date='2000-10-10-00' 
	  data-title='Another Event' 
	  data-class='orange' 
	  data-img = 'Timeline Example/Timeline_2.jpg' 
	  data-type='range' 
	  data-end='2000-10-20-00'> 
	A second event!
</span>

Timeline span and div entries (.ob-timelines class) are hidden in preview by default, however, if you wish to display content, try a snippet like this:

/* Render the ob-timelines span or div elements as inline blocks that use an italic font */
.ob-timelines {
  display: inline-block !important;
  font-style: italic;
}
/* Use the before pseudo element to display attributes of the span or div */
.ob-timelines::before {
  content: "🔖 " attr(data-date) ": " attr(data-title) ". ";
  color: lilac;
  font-weight: 500;
}

Using the above snippet, a span like this:

<span class='ob-timelines' data-date='1499-03-28-00' data-title="An example"></span>

would be rendered as:

<img width="228" alt="image" src="https://user-images.githubusercontent.com/808713/159139934-e5c7cb5a-da31-4a57-8100-946f944010a3.png">

Dates

The most important and essential info for the timeline entry is the date. Timeline entries can be used for fantasy timelines, leading to a simplified set of rules for valid dates.

A valid date is specified as YEAR-MONTH-DAY-HOUR.

Rightmost-segments containing only zeros will be omitted when the timeline is generated, for example:

Event sorting

Event sorting is performed by converting the date into a number. For fantasy calendars, you may need to pad months, days, or hours with zeros to ensure sorting works properly.

For statically generated timelines, events that occur at the same time are grouped, and are either prepended or appended to a list based on your timeline sorting preference.

Title:

Description:

Background Image:

CSS Class:

Release Notes

v0.2.1

PR Contribution by https://github.com/ebullient

v0.2.0

Licence

Licenced under the MIT License.

Support

Github Sponsorship <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="BuyMeACoffee" width="100">