diff --git a/NEWS.md b/NEWS.md index 13d334a98..a63717dea 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ ## BUG FIXES +- Correctly encode the document title when creating the twitter sharing link from a bookdown chapter (thanks, @maelle, #934). + - Make sure `search_index.json` contains valid characters for the JSON format (thanks, @wlandau, #913). ## MINOR CHANGES diff --git a/inst/resources/gitbook/js/plugin-sharing.js b/inst/resources/gitbook/js/plugin-sharing.js index 8d279518d..1994e6c7c 100644 --- a/inst/resources/gitbook/js/plugin-sharing.js +++ b/inst/resources/gitbook/js/plugin-sharing.js @@ -23,7 +23,7 @@ gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) { 'icon': 'fa fa-twitter', 'onClick': function(e) { e.preventDefault(); - window.open("http://twitter.com/intent/tweet?text="+document.title+"&url="+encodeURIComponent(location.href)+"&hashtags=rmarkdown,bookdown"); + window.open("http://twitter.com/intent/tweet?text="+encodeURIComponent(document.title)+"&url="+encodeURIComponent(location.href)+"&hashtags=rmarkdown,bookdown"); } }, 'linkedin': {