yishn / tikzcd-editor

A simple visual editor for creating commutative diagrams.
https://tikzcd.yichuanshen.de/
MIT License
1.86k stars 100 forks source link

Using compression for shorter URLs? #49

Closed gakada closed 4 years ago

gakada commented 4 years ago

For example, with a library like https://github.com/polygonplanet/lzbase62 b64EncodeUnicode and b64DecodeUnicode can be defined just as

export const b64EncodeUnicode = lzbase62.compress
export const b64DecodeUnicode = lzbase62.decompress

making URLs a bit shorter (something like 300 characters instead of 500, if I look at one example).

yishn commented 4 years ago

We're already compressing links with the lz-string module for new diagrams.

gakada commented 4 years ago

I see, maybe just library difference then, I used lzbase62 some time ago and it seems a bit shorter, e.g.

https://tikzcd.yichuanshen.de/#N4Igdg9gJgpgziAXAbVABwnAlgFyxMJZARgBpiBdUkANwEMAbAVxiRAAUQBfU9TXfIRRkATFVqMWbABrdeIDNjwEiI8uPrNWiEAE05fJYNWkx1TVJ0AtAwv7KhyAAyknGydpABFbuJhQAc3giUAAzACcIAFskFxAcCCQyCS02NAB9YhBqBjoAIxgGdntjHXCsAIALHFsI6NjqBKQ1FMsFdJFayJjEZKbEAGZzDzZQ7JBcgqKSlTKK6q76xBb+odbPAMWegBZGxMQ4hiwwTyg6OEr-cYtPJi2kXfj9loKwKCQBuJu2AEcO+8Qj36yVe70QAFpPsNUjo-lkcvlCsUjLMQOUqjUuBQuEA

354

https://gakada.github.io/cd/#uDritefUVjrisStL2KtgfjZkZfexNDsIEItNsEritmRclV2OritBriuFsExfNsJEJxfLtAxfQsKxfNtJyBSsKxfLtIyBSxfMtK2fxODtVUXzrHtWifd2J4mritkf2H3NxoJtlri2MtcZexLEtURjY2xyaFxuN3cxuJthPsKxwDtSVe2nsSLIxqRsLxqMsJydEtR2stcAzqJritiZXYkyFJsFyGMzaDyGPtgyGbx4RzrL244rxgKxZDxgEsMxgKtXxeLyyDxePtWy3atNuF

274.

yishn commented 4 years ago

I think it is good enough. Changing the compression algorithm means we need to support three ways of parsing the URL if we want to remain backward compatible..