Skip to content

Commit aa8dd1b

Browse files
GollyTickerVinzent03jakobhellermann
authored
feat: Line Authoring
* Rename getPath to be more informative. * Added test-vault. * Added package-lock.json. Added dependencies for line authoring. * Fix stricter type-errors. * Line authoring feature. * feature can be toggled * submodule support * follow cut-copy-paste operations and show the original commit where a line was created * only available on desktops * file rename support * configurable in Settings: * commit hash, author formatting, date+time formatting * max age * max and min age colors * accessible default colors * configure following of cut-copy-paste operations * view: * gutter left to line numbers shows the newest commit where the line was changed * Coloring by age * multi-line rendered block support (e.g. dataview, <pre>) shows newest commit * support for markdown syntax with unequal line-sizes * adaptive to dark and light mode * copy commit hash with context-menu * natural language dates (i.e. 'a week ago') * soft and unintrusive updating of the colored gutters when opening new panes * test-vault: * Fake dates in test-vault file for easier testing * Allows literal filepaths and filepaths with dashes * robust error handlung * fix: respect base path * More features: * Settings in nested object * Typescript documentation * Developer documentation * feature guide in wiki * Remove stale subscribers infrequently to reduce load. * Date format string URL in settings UI * add deep-equal types * remove ALLOWSIMPLEGIT global * remove inflect * use built in moment * Added UTC+0 time-zone * Minor fixes. Improved settings. Added link to feature guide. * Minior styling improvement. * fix: middle click to open file/diff in new tab * feat: prefill edit remote modal * chore(release): 2.4.0 * fix: keep git view on unload close #321 * chore(release): 2.4.1 * fix typo (`two` -> `to`) * Fix copy-able dummy-commit hash * Line Author Features: * Performance: avoid dom recomputation and gutter instance re-creation * Performance: Compute line markers once per action, instead of many times per action * Added context menu quick configuration * Adapted to Obsidian v1.0 * Cleanup. * Fix gutter spacing in Obsidian v1.0 * Fix adaptive coloring, which was broken due to caching. * Improve wording. * Fixed first, last and full name display. * Added option to ignore whitespace and newlines. * Added quick gutter update of unsaved changes * Reprioritise * Fix: messy ui when quick gutter update in empty file or in large vault * Potential future feature * update test-vault * Added setting to set text color css. * Fix gutter size for empty untracked files * Updated simple-git to 3.16.0 due to vulnerability * Show custom line author date format only when applicable. * refactor: use export * style: minor formatting * Simplify moment usage. * fix: format and fix imports * remove package-lock.json * fix moment imports * remove currentMoment * better isNewerThan implementation * remove submodule * move dev doc * fix: move git-head-update event to simple git * remove test log * link to test-vault * docs: add line authoring * docs: add GollyTicker as contributor to readme * docs: Refactor. Fix link --------- Co-authored-by: Vinzent <vinzent03@proton.me> Co-authored-by: Jakob Hellermann <jakob.hellermann@protonmail.com>
1 parent 782f810 commit aa8dd1b

File tree

64 files changed

+3957
-263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3957
-263
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
# npm
66
node_modules
7-
package-lock.json
87
main.js
98
yarn.lock
109

@@ -15,4 +14,4 @@ yarn.lock
1514
.prettierrc.json
1615
/data.json
1716

18-
.vscode
17+
.vscode

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ The fastest way to work on mobile if you have a large repo/vault is to stage ind
8989

9090
## Contact
9191

92+
The Line Authoring feature was developed by [GollyTicker](https://github.com/GollyTicker), so any questions may be best answered by him.
93+
9294
If you have any kind of feedback or questions, feel free to reach out via GitHub issues or `@Vinadon` on [Obsidian Discord server](https://discord.com/invite/veuWUTm).
9395

9496
This plugin was initial developed by [denolehov](https://github.com/denolehov). Since March 2021, it is [Vinzent03](https://github.com/Vinzent03) who is developing on this plugin.

doc/01 Start here.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ aliases:
1212
- [[05 Features|Features]]
1313
- [[06 Tips-and-Tricks|Tips-and-Tricks]]
1414
- [[07 Common issues|Common Issues]]
15+
- [[08 Line Authoring|Line Authoring]]
1516

1617
> [!warning] Obsidian installation on Linux
1718
> Please don't use Flatpak or Snap to install Obsidian on Linux. Learn more [[02 Installation#Linux|here]]

doc/05 Features.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Open it using the "Open Source Control View" command. It lists all current chang
1313

1414
Open it using the "Open History View" command. It behaves like `git log` resulting in a list of the last commits. Each commit entry can be expanded to see the changed files in that commit. By clicking on a file, you can even see the specific diff.
1515

16+
## Line Authoring
17+
18+
For each line, view the last time, it was modified: [[08 Line Authoring|Line Authoring]]. Technically known as `git-blame`.
19+
1620
## Automatic Backup
1721

1822
See [[01 Start here#Backup|Backup]] for an explanation of the term. The goal of automatic Backups is that you can focus on taking notes and not to care about saving your work, because this plugin will take care of it.

doc/08 Line Authoring.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# Quick User Guide
2+
3+
A quick showcase of all functionality. This feature is based on [git-blame](https://git-scm.com/docs/git-blame).
4+
5+
ℹ️ The line author view only works in Live-Preview and Source mode - not in Reading mode.
6+
7+
ℹ️ Currently, only Obsidian on desktop is supported.
8+
9+
ℹ️ The recently released Obsidian v1.0 is fully supported. The images and GIFs in this document are however not yet updated.
10+
11+
## Activate
12+
13+
![](assets/line-author-activate.png)
14+
15+
It can also be activated via Command Palette `Obsidian Git: Toggle line author information`.
16+
17+
## Default line author information
18+
19+
![](assets/line-author-default.png)
20+
21+
Shows the initials of the author as well as the authoring date in `YYYY-MM-DD` format.
22+
23+
The `*` indicates, that the author and committer (or their timestamps) are different - i.e., due to a rebase.
24+
25+
## Commit hash and full name
26+
27+
![](assets/line-author-commit-hash-full-name.png)
28+
29+
via config
30+
31+
![](assets/line-author-commit-hash-full-name-config.png)
32+
33+
## Natural language dates
34+
35+
![](assets/line-author-natural-language-dates.png)
36+
37+
## Custom date formats
38+
39+
![](assets/line-author-custom-dates.png)
40+
41+
via config
42+
43+
![](assets/line-author-custom-dates-config.png)
44+
45+
## Commit time in local/author/UTC time-zone
46+
47+
**UTC+0000/Z**
48+
49+
The simplest option to start with is showing the time in `UTC+00:00/Z` time-zone.
50+
This is independent of both your local and the author's time-zone.
51+
It is shown with a suffix `Z` to avoid confusion with local time.
52+
53+
![](assets/line-author-tz-utc0000.png)
54+
55+
This is the time displayed in the guter is the same for all users.
56+
57+
**My local (default)**
58+
59+
By default, the times are shown in your local time-zone - i.e., `What was the clock-time at my wall showing, when the commit was made?` This depends on your local time-zone. For instance, this is the view for a user in the `UTC+01:00` time-zone.
60+
61+
![](assets/line-author-tz-viewer-plus0100.png)
62+
63+
Note, how the displayed time is `1h` ahead of the above `UTC+0000` time.
64+
65+
**Author's local**
66+
67+
Alternatively, it can show it in the author's time-zone with explicit `UTC` offset - i.e., `What was clock-time at the author's wall and their explicit UTC offset, when the commit was made?`
68+
69+
This is independent of your local time-zone and the same time is displayed for all users.
70+
71+
![](assets/line-author-tz-author-local.png)
72+
73+
**Configuration**
74+
75+
![](assets/line-author-tz-config.png)
76+
77+
## Age-based gutter colors
78+
79+
The line gutter color is based on the age of the commit. It adapts to the dark/light mode automatically.
80+
81+
![](assets/line-author-dark-light.gif)
82+
83+
Red-ish means newer and blue-ish means older. All commits at and above a certain maximum coloring
84+
age (configurable; default `1 year`) get the same strongest blue-ish color.
85+
86+
The colors are configurable and the defaults are chosen to be accessible.
87+
88+
![](assets/line-author-color-config.png)
89+
90+
## Adjust text color CSS based on theme
91+
92+
By default, the gutter text color uses `var(--text-muted)` which
93+
is whatever is defined by your theme. You can however, change it to a different CSS
94+
color or variable.
95+
96+
![](assets/line-author-text-color.png)
97+
98+
Example:
99+
| `var(--text-muted)` | `var(--text-normal)` |
100+
|----------------------------------------------|-----------------------------------------------|
101+
| ![](assets/line-author-text-color-muted.png) | ![](assets/line-author-text-color-normal.png) |
102+
103+
## Copy commit hash
104+
105+
![](assets/line-author-copy-commit-hash.png)
106+
107+
## Quick configure gutter
108+
109+
![](assets/line-author-quick-configure-gutter.gif)
110+
111+
## New/uncommitted lines and files show `+++`
112+
113+
![](assets/line-author-untracked.png)
114+
115+
## Follow lines across cut-copy-paste-ing within same commit / all commits
116+
117+
By default, each line shows the last commit, where it was changed.
118+
This means, that cut-copy-paste-ing lines will show the new commit,
119+
even though it was not originally written in that commit.
120+
121+
![](assets/line-author-follow-no-follow.png)
122+
123+
However, if for instance following is set to `all commits`, then this is the result:
124+
125+
![](assets/line-author-follow-all-commits.png)
126+
127+
Configuration:
128+
129+
![](assets/line-author-follow-config.png)
130+
131+
## Soft and unintrusive ansynchronous view updates
132+
133+
Since computing the line author information takes time (due to a `git blame` shell invocation)
134+
the result appears delayed. To minimize distraction and improve user experience,
135+
the view is updated in a soft and unintrusive manner.
136+
137+
When opening a file, a placeholder is shown meanwhile:
138+
139+
![](assets/line-author-soft-unintrusive-ux.gif)
140+
141+
While editing, a placeholder is shown as well until the file is saved and the line author information is computed.
142+
143+
![](assets/line-author-soft-unintrusive-ux-editing.gif)
144+
145+
## Multi-line block support
146+
147+
The markdown rendering of multiple lines as a combined block is also supported.
148+
In this case the newest of all lines is shown in the gutter.
149+
150+
![](assets/line-author-multi-line-newest.gif)
151+
152+
## Ignore whitespace and newlines
153+
154+
This can be activated in the settings.
155+
156+
| **Original** | **Changed with preserved whitespace** | **Changed with ignored whitespace** |
157+
|------------------------------------------------------|-------------------------------------------------------|-------------------------------------------------------|
158+
| ![](assets/line-author-ignore-whitespace-before.png) | ![](assets/line-author-ignore-whitespace-preserved.png) | ![](assets/line-author-ignore-whitespace-ignored.png) |
159+
160+
Note, how ignoring the whitespace does not mark the indented
161+
lines as changes, as only additional whitespace was added.
162+
163+
## Submodules support
164+
165+
Line author information is fully supported in submodules.

doc/assets/line-author-activate.png

21.1 KB
Loading
54.2 KB
Loading
Loading
31.1 KB
Loading
28.9 KB
Loading

0 commit comments

Comments
 (0)