NUKnightLab / TimelineJS3

TimelineJS v3: A Storytelling Timeline built in JavaScript. http://timeline.knightlab.com
Mozilla Public License 2.0
3k stars 621 forks source link

suggestion for issue 676 #790

Open paul-hammant opened 2 years ago

paul-hammant commented 2 years ago

Hi Joe. Is this sort of thing OK for #676 ? (jest tests pass)

I'd want deterministic logic that can override defaults.

Scenarios (all in the same timeline)

  1. "headline": "Report: turns out Einstein was wrong" could have a hash of "#report-turns-out-einstein-was-wrong"

  2. "headline": "Opinion: Soccer matches ending in nil-nil leaves fans bitter" could have a hash of "#opinion-soccer-matches-ending-in-nil-nil-leaves-fans-bitter"

  3. "headline": "Eurovision song contest won by Ukraine" could have a hash of "#event-eurovision-song-contest-won-by -ukraine"

To achieve that I'd have deterministic logic to look for "Report" and "Opinion" at the start of a headline for custom hashes, but default to "Event" (as now) for situations where I can't pick out either of those two alternates.