Closed the-turk closed 4 years ago
We're started to store revisions as a whole instead of diffs-only as of 0.1.0-beta.7 (after a long discussion in discuss). But there are still couple of concerns about this manner. What will happen if the user change an URL in markdown markup? or an attribute from a BBCode?
Old Post:
[Google](google.com)
Outputs: <a href="google.com">Google</a>
New Post:
[Google](duckduckgo.com)
Outputs: <a href="duckduckgo.com">Google</a>
Comparison Result:
[Google](<ins>duckduck</ins>go<del>oogle</del>.com)
Outputs: <a href="<ins>duckduck</ins>go<del>oogle</del>.com">Google</a>
These are just simple examples and there is no only one solution for them all. Unfortunately, jfcherng's php-diff library is not supporting comparison between HTML codes and even if i could fork it, i can't promise you a lifetime repository.
I'll be listening to your suggestions if you have any.
1.0.0's "preview for all revisions" feature is kind of covering this enhancement.
We need to store all of the old post's content in the database rather than storing changed parts (diffs) only.
Old Post:
New Post:
Now let's say we set the context to 1 lines. Comparison Output will be like this:
Calculated diff doesn't know anything about the change has been made in the code block, so we don't either. Here's another one:
Old Post:
New Post:
Comparison Output:
Then again, we don't know anything about indentation. What could be done is to storing full contents from both versions. What will happen if you just change a character from a post which has 1k words? Is it really necessary to show the HTML output though? I think not.