Skip to content

Commit

Permalink
test giscus integration for openhab tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Nov 10, 2022
1 parent b34edaf commit e654bf7
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 8 deletions.
50 changes: 50 additions & 0 deletions docs/_templates/partials/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{% if page.meta.comments %}
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>

<!-- Insert generated snippet here -->
<script src="https://giscus.app/client.js"
data-repo="2bndy5/CircuitPython_Homie"
data-repo-id="R_kgDOIDmRcw"
data-category="Q&A"
data-category-id="DIC_kwDOIDmRc84CSeJn"
data-mapping="title"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="bottom"
data-theme="preferred_color_scheme"
data-lang="en"
crossorigin="anonymous"
async>
</script>

<!-- Synchronize Giscus theme with palette -->
<script>
var giscus = document.querySelector("script[src*=giscus]")

/* Set palette on initial load */
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"
giscus.setAttribute("data-theme", theme)
}

/* Register event handlers after documented loaded */
document.addEventListener("DOMContentLoaded", function() {
var ref = document.querySelector("[data-md-component=palette]")
ref.addEventListener("change", function() {
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"

/* Instruct Giscus to change theme */
var frame = document.querySelector(".giscus-frame")
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme } } },
"https://giscus.app"
)
}
})
})
</script>
{% endif %}
6 changes: 1 addition & 5 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense

sphinx-immaterial
git+https://github.com/jbms/sphinx-immaterial.git@add-comments-meta-data
sphinxcontrib-details-directive
8 changes: 5 additions & 3 deletions docs/tutorials/openhab.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

:comments:

Using Homie with OpenHAB
=========================

.. role:: oh-red(literal)
:class: oh-red oh
.. role:: oh-green(literal)
Expand All @@ -16,9 +21,6 @@
.. |oh-item| replace:: OpenHAB Item
.. |homie-dev| replace:: Homie Device

Using Homie with OpenHAB_
=========================

OpenHAB_ is a Java based software that can be used on a computer connected to your Local Area
Network (LAN) to monitor (or control) various "smart devices" in your home (or building).
Typically, it is meant to be installed to a headless machine like a Raspberry Pi, but any
Expand Down

0 comments on commit e654bf7

Please sign in to comment.