codimd
codimd copied to clipboard
The shortname of Disqus could contain dash character.
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';
PR https://github.com/hackmdio/codimd/pull/1750 is dealing with this issue.
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.