Repository: PrefectHQ/prefect

Issue:
**kwargs not allowed inside code blocks inside Method tables
When working on #657 I came across a weird doc-building bug; if a code example using `**kwargs` (really, just `**`) appears in a method / function which is documented within a "methods table", the doc build will fail.  To be concrete, my example code block in #657 was originally:
```python
    class MyTask(Task):                                                             
        def __init__(self, a=None, b=None, **kwargs):                                         
            self.a = a                                                              
            self.b = b                                                              
                                                                                    
        @defaults_from_attrs(['a', 'b'])                                            
        def run(self, a=None, b=None):                                              
            return a, b                                                             
                                                                                    
    task = MyTask(a=1, b=2)                                                         
                                                                                    
    task.run() # (1, 2)                                                             
    task.run(a=99) # (99, 2)                                                        
    task.run(a=None, b=None) # (None, None)  
```
but, because [the methods table specifically](https://github.com/PrefectHQ/prefect/blob/master/docs/generate_docs.py#L139-L145) uses a [custom tokenizer](https://github.com/PrefectHQ/prefect/blob/master/docs/generate_docs.py#L30), `**` is being picked up as markdown, causing a weird set of tags to emerge.

I believe this issue can be fixed within [the tokenizer](https://github.com/PrefectHQ/prefect/blob/master/docs/tokenizer.py#L61) but it'll require some digging.


Discussion:

Resolving patch:
diff --git a/docs/generate_docs.py b/docs/generate_docs.py
--- a/docs/generate_docs.py
+++ b/docs/generate_docs.py
@@ -140,7 +140,7 @@ def format_doc(obj, in_table=False):
             block = block[block.startswith("python") and 6 :].lstrip("\n")
             block = (
                 '<pre class="language-python"><code class="language-python">'
-                + format_code(block).replace("\n", "<br>")
+                + format_code(block).replace("\n", "<br>").replace("*", "\*")
                 + "</code></pre>"
             )
         cleaned = cleaned.replace(f"$CODEBLOCK{num}", block.rstrip(" "))


Test patch:
diff --git a/docs/test_generate_docs.py b/docs/test_generate_docs.py
--- a/docs/test_generate_docs.py
+++ b/docs/test_generate_docs.py
@@ -404,6 +404,20 @@ def doc_fun():
     assert sub_string in res
 
 
+def test_format_doc_escapes_asteriks_inside_tables():
+    def my_doc():
+        """
+        See:
+            ```python
+            my_doc(**kwargs)
+            ```
+        """
+        pass
+
+    res = format_doc(my_doc, in_table=True)
+    assert res.count(">\*<") == 2
+
+
 @pytest.mark.parametrize(
     "fn", [fn for page in OUTLINE for fn in page.get("functions", [])]
 )