To be able to use goodpress to publish posts on your WordPress website, you need to perform a few setup steps. You only need to do these once, so that’s only potentially painful at setup.
You might not need to tweak syntax highlighting and math stuff if you, well, never show code or never show math equations in your posts.
From WordPress point-of-view this package is a “remote application” therefore it needs your website to use an authentication plugin. At the moment, for the sake of simplicity, this package only relies on Application Passwords.
You cannot install plugins if you use wordpress.com (unless you have a costly business plan there), therefore with wordpress.com you cannot use the REST API. There are paid services out there providing a domain name, hosting and a one-click WordPress install, for a few dollars a month, that you could use if you don’t roll your own server.
Here’s what I did to be able to use this package on my test website:
.Renviron, save username as
WP_USERand application password as
WP_PWD. Re-start R. Keep
.Renvironsafe, it contains secrets! Here’s an example of .Renviron below, the empty line at the end of the file is needed.
To get syntax highlighting for R blocks, at the moment you need to add custom CSS (once, like the plugin setup stuff).
system.file(file.path("css", "code.css"), package = "goodpress")and copy it to your clipboard.
You could edit colors that are in the CSS file.
Later I hope to make this process easier, maybe by adding inline styles.
To be able to use math with MathJax, you’ll need to customize your theme.
From WordPress interface go to Appearance > Theme Editor. Add the lines below (that come from MathJax docs) to the
<head> div of
header.php, then save.
Then refer to the usage vignette.