Your comments are welcome
Last Updated: 2025 January 18 (2025 Jan 14 2025)
View 4 comment(s).You can comment on my blogs from the Fediverse by replying to specific statuses listed at the bottom of the page.1 However, the oldest blogs won’t have a comments section because the topics are too far behind me to bring up again on my timeline.
You’re also welcome to use the filter.
Using the filter
If your instance requires authorization for API access, there is an extra step before doing this.
TL;DR
- modify or create an html template to render variables exported by the script
- add to the manuscript’s YAML header
pleroma-urls: [https://yourinstance.tld/notice/noticeID]
- invoke pandoc with
--lua-filter=scripts/pleroma-comments/pleroma-comments.lua \
Here’s an example of how I invoke pandoc
.
pandoc \
--template $(TEMPLATES)/simple_v4 \
--lua-filter=scripts/pleroma-comments/pleroma-comments.lua \
$(DRAFTS)/hanvon-linux.md \
--toc -o $(RENDERS)/hanvon-linux.html
In hanvon-linux.md
(my document), my YAML header has
the variable pleroma-urls
set like so.
This is a list, so multiple URLs can be included if separated by a comma.
The template should have the variables exported by the script. I have something like this at the bottom of the page template.
$if(pleroma-urls)$
<hr/>
<h2 id="comments">Comments ($pleroma-comments-count$)</h2>
<p>Reply to any of the bulleted links to leave a comment.</p>
<ul>
$for(pleroma)$
<li><a href="$pleroma.link$">$pleroma.id$</a></li>
$endfor$
</ul>
$pleroma-comments$
$endif$
The README in the git repo has more detail on what the variables represent.
The resulting “comments” from invoking pandoc includes both the opening post and any replies.
If authorization is required
The following links describe how to authorize an application (this
Lua filter) by acquiring an access token. This phase involves using
curl
and/or a web browser.
Register the Lua filter (the “application” = the “client”) with the instance. https://docs.joinmastodon.org/client/token/#creating-our-application
Authorize the client to access the account. https://docs.joinmastodon.org/client/authorized/#client
After following the aforementioned steps, the server should have
returned an access token. Upon visiting yourinstance.tld
in a web browser, if you open
Settings > Security: OAuth Token
, the change should be
reflected there. You, the user, can always revoke the token if needed
be.
In your local file system and the working directory where
pandoc
is executed, make or edit a file named
config.lua
:
pleroma_auth_token = "your_access_token"
Execute pandoc
as described in using the filter
Commentary
I came across curveballs when writing the lua filter and posted about them on my timeline. I’m including them here as comments partly because I realize I could use the filter as a timeline of notes instead of a comments section.
This Lua filter is shared with: https://antares.neocities.org/blog/pandoc-filter-pleroma-comments. It’s also his idea.↩︎
Thanks for reading! Who doesn't love comments? Let me know what you think on my guestbook by e-mail or neocities.