okjuan / vbook

0 stars 0 forks source link

Revisions: Fix bugs in revision diff formatting #27

Open okjuan opened 1 month ago

okjuan commented 1 month ago

There are a few problems.

Problem 1

UPDATE: Fixed by #37

Bold is overloaded. I use it in revisions to mark text added in a revision but I also use it for other purposes like quoting and emphasis. These conflict and confuse the Markdown -> HTML translation in revisions.rb. A viable solution here is to use <ins> to mark text added in a revision.

e.g. for okjuan.me/vbook/use-words/revs/9/

Screenshot 2024-10-20 at 1 59 12 PM

Problem 2

UPDATE: Fixed by #37

Git diff doesn't respect (or understand) markdown formatting. So, it sometimes creates diff tokens such that markdown links get split into multiple diff tokens. For example, From [-Robert Pirosh's [extraordinarily memorable-]{+the [memorable+} cover [-letter](https://lettersofnote.com/2012/03/13/i-like-words/):-]{+letter](https://lettersofnote.com/2012/03/13/i-like-words/) Robert Pirosh submitted for a copywriting job:+}. I have two solutions: 1) find and replace incomplete MD formatting in each diff token or 2) configure the git diff command in revisions.rb by setting the --word-diff-regex option to customize how words are calculated.

e.g. also for okjuan.me/vbook/use-words/revs/9/

Screenshot 2024-10-20 at 1 59 48 PM

Problem 3

Very similar to Problem 2. Git sometimes creates diff tokens such that markdown tokens get split partially into a diff token and partially out of a diff token.

e.g. for okjuan.me/vbook/tell-a-story-3/revs/2/

image

e.g. for okjuan.me/vbook/use-words/revs/7/

Screenshot 2024-10-21 at 9 12 57 PM

Problem 4

Screenshot 2024-10-21 at 9 13 02 PM

Markdown quote > not formatted.

okjuan commented 3 days ago

Partially addressed by #37. Reopening because not fully addressed yet.