Added README

This commit is contained in:
antares 2024-11-30 20:17:10 -08:00
parent 58a74d88c1
commit 045d993ddc

41
README.md Normal file
View File

@ -0,0 +1,41 @@
# 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$