Adding Help Text

Now let us add some help to the Hello function so that World will know about it. This is done in the docstring for the Hello class and the markup is largely XML/HTML.

from mathics.builtin.base import Builtin, String

class Hello2(Builtin):
    <dd>Print a "Hello" message customized for $person$.

  This is an example of how Python Builtin-Symbol documentation works.

  def apply(person: String, evaluation) -> String:
        return String(f"Hello, {person.get_string_value()})!"

The XML tagging that gets created from the above renders in the Django interface like this:

Rendering XML help markup in Django

In the Django interace on the right-hand side, I hit the “?” button and started typing “H E L L” and that was enough for the Django to find it. Django will pick up this change without having to restart it!

This is how the text appears geting help via ? in mathicsscript:

Rendering XML help markup in Django

See For Help Text for more a list of help-related markup.