hackmdio / codimd

CodiMD - Realtime collaborative markdown notes on all platforms.
https://hackmd.io/c/codimd-documentation
GNU Affero General Public License v3.0
9.24k stars 1.05k forks source link

The shortname of Disqus could contain dash character. #1751

Open Hsins opened 2 years ago

Hsins commented 2 years ago

As shown in the figure screenshot from Create a New Site Page on the right-hand side.

The unique Disqus URL could be combined of :

CodiMD handles the Disqus section in the disqus.ejs. But it doesn't work for shortnames containing dash character, and it doesn't handle shortnames with uppercase letters currently.

It would be better to modify it as following code:

- s.src = 'https://<%= disqus.replace(/[^A-Za-z0-9]+/g, '') %>.disqus.com/embed.js';
+ s.src = 'https://<%= disqus.toLowerCase().replace(/[^a-z0-9-]+/g, '') %>.disqus.com/embed.js';
Hsins commented 2 years ago

PR https://github.com/hackmdio/codimd/pull/1750 is dealing with this issue.

jackycute commented 1 year ago

Hi @Hsins, Thanks for the help! Could you open a PR for this modification? We like to merge this fix which also convert to lowercase before regex replace.