ncn-foreigners / nonprobsvy

An R package for modern methods for non-probability surveys
https://ncn-foreigners.github.io/nonprobsvy/
Other
29 stars 5 forks source link

Fixing math in GitHub Pages site generated by pkgdown #56

Open bschneidr opened 3 hours ago

bschneidr commented 3 hours ago

Hello,

I was writing because I noticed that the math on the GitHub Pages site generated by pkgdown is not currently rendering correctly, making it harder to read the documentation. This is an open issue with the pkgdown package that doesn't seem to be getting fixed anytime soon:

https://github.com/r-lib/pkgdown/issues/2704

I recently dealt with this problem in the 'svrep' package and so wanted to share a solution you can use to fix it, based on a suggestion from a discussion in that GitHub issue. In 'svrep', I had to make this change to the 'svrep' "_pkgdown.yml" file:

https://github.com/bschneidr/svrep/blob/main/_pkgdown.yml

template:
  bootstrap: 5
  includes:
    in_header: |
      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous">
      <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script>
      <script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>

Just wanted to pass this along in case it's helpful- the package documentation for 'nonprobsvy' is generally excellent, and it's a shame that the pkgdown site is glitching for it.

BERENZ commented 3 hours ago

Hi @bschneidr,

thank you for reporting this. Currently, we are working on a major update of the package so we will include fix for this problem.

In the meantime you can go through the theory explained in Łukasz Chrostowski Master's thesis that is located here. It covers all the methods and their extensions that we have implemented in the package.

bschneidr commented 2 hours ago

Thanks for the quick reply @BERENZ. I submitted a pull request that you can go ahead and incorporate if you want for the current version of the package. Thanks for pointing out the thesis article with more details.

BERENZ commented 2 hours ago

Thanks! Hope you will enjoy working with the package.

Actually, we plan to include the svrep package as we currently only support the survey package (and its way of replicating sampling weights).