codimd icon indicating copy to clipboard operation
codimd copied to clipboard

The shortname of Disqus could contain dash character.

Open Hsins opened this issue 3 years ago • 2 comments
trafficstars

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 :

  • Lowercase Letters: abcdefghijklmnopqrstuvwxyz
  • Numbers: 0123456789
  • Dash: -

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 avatar Mar 03 '22 08:03 Hsins

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

Hsins avatar Mar 03 '22 08:03 Hsins

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.

jackycute avatar Jan 13 '23 07:01 jackycute