pleroma-comments/README.md

42 lines
1.5 KiB
Markdown
Raw Normal View History

2024-12-01 09:47:10 +05:30
# Pleroma Comments
**Pleroma Comments** is a Pandoc filter that generates a comments section by fetching replies from the Fediverse (through Pleroma servers).
Example: [https://antares.neocities.org/blog/pandoc-filter-pleroma-comments](https://antares.neocities.org/blog/pandoc-filter-pleroma-comments)
## Variables
The filter uses the variable `pleroma-urls` for input which can be defined in the manuscript's YAML header.
* `pleroma-urls`: a list of strings that should contain the URLs of the posts to source replies from.
The filter exports variables that can be used in a pandoc template.
* `pleroma-comments`: string, the full comments section rendered by the script.
* `pleroma-comments-count`: integer, the number of comments received by the script.
* `pleroma-has-comments`: boolean, whether or not there are comments available
* `pleroma`: table of strings, post IDs and their full URLs.
## Usage
In a Pandoc template, include the following to generate the entire comments section.
$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$
Add a link to jump to the comments section if there are any comments.
$if(pleroma-has-comments)$
<a href="#comments">View $pleroma-comments-count$ comment(s).</a>
$endif$