TextformatterFootnotes by EPRC

Adds footnotes using Markdown Extra’s syntax, minus Markdown

TextformatterFootnotes

This textformatter adds footnotes using Markdown Extra’s syntax, minus Markdown.

screenshot

Modules directory: https://processwire.com/modules/textformatter-footnotes/

Support forum: https://processwire.com/talk/topic/28344-textformatterfoonotes/

About


This textformatter was primarly created to ease the addition of footnotes within HTML textareas (CKEditor or TinyMCE) using Markdown Extra’s syntax. It will also retain any inline formatting tags that are whitelisted.

Usage


To create a footnote reference, add a caret and an identifier inside brackets ([^1]). Then add the footnote in its own line using another caret and number inside brackets with a colon and text ([^1]: My footnote.). It will be put automatically inside the footnotes block at the end of the text.

Notes

  • the identifier has to be a number but it is permissive in that you can put in the wrong order and it will be numbered back sequentially
  • there is no support for indentation, though since <br> tags are allowed you should be fine
  • if a footnote has no corresponding reference, it will be ignored and left as is

Options


In the module settings, you can change the icon (string) used as the backreference link but also the classes used for the wrapper, the reference and backreference links. You can also edit the list of whitelisted HTML tags that won’t be removed in the footnotes.

Hook


If you want to have a more granular control over the footnotes (e.g. per field), you can use this hook:

$wire->addHookBefore("TextformatterFootnotes::addFootnotes", function(HookEvent $event) {
	$str = $event->arguments(0);
	$options = $event->arguments(1);
	$field = $event->arguments(2);

	if($field != "your-field-name") return;

	// Say you want to change the icon for a <svg>
	$options["icon"] = file_get_contents("{$event->config->paths->templates}assets/icons/up.svg");
	// Or change the wrapper’s class
	$options["wrapperClass"] = "my-own-wrapper-class";

	// Put back the updated options array
	$event->arguments(1, $options);
});

Check the source code for more options.

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Latest news

  • ProcessWire Weekly #519
    In the 519th issue of ProcessWire Weekly we'll check out a new third party module called RockForms, introduce the latest ProcessWire core updates, and more. Read on!
    Weekly.pw / 20 April 2024
  • ProFields Table Field with Actions support
    This week we have some updates for the ProFields table field (FieldtypeTable). These updates are primarily focused on adding new tools for the editor to facilitate input and management of content in a table field.
    Blog / 12 April 2024
  • Subscribe to weekly ProcessWire news

“Yesterday I sent the client a short documentation for their ProcessWire-powered website. Today all features already used with no questions. #cmsdoneright—Marc Hinse, Web designer/developer