Filter in function docstrings?

I’m confused about filtering in docstrings. I know that I can use them in the markdown files of Documenter. But can they be used in regular function docstrings (those embedded in the code)?

One thing that is confusing me is that the semicolon after the jldoctest in these docstrings has the purpose of removing the julia> prompt from the docstring (as far as I understand), but at the same time it should separate the options (like the filter) from the keyword.

Thus, is this valid within a Julia codebase?

```#
      foo()
   
    # Example

    ```jldoctest filter = "\\d+" => ""
    julia> foo()
    0.89798572345
    ```
```#
foo() = rand()

I’m getting errors I don’t understand, and maybe related to the confusion I’m making about the use of the filters in this context. In particular, doctests sometimes pass or not depending on having or not a semicolon there after the jldoctest;.

1 Like

Seems that a lot of the issues are solved by moving the semicolon position.

This works:

jldoctest ;filter = ... 

but this doesn’t filter and removes the julia> prompts:

jldoctest; filter = ...

Another thing is that escaping characters in a docstring function filter is different from the escaping of the filter in the markdown.

There is a Zulip stream that may be involved, and I think this has been resolved.
https://julialang.zulipchat.com/#narrow/stream/225542-helpdesk/topic/strange.20errors.20in.20jldoctests.20.28part.201.29/near/436593025

In short, I think that it is nothing more than a syntax error (as Discourse’s syntax highliting suggests).