# Filter in function docstrings?

**URL:** https://discourse.julialang.org/t/filter-in-function-docstrings/113795
**Category:** General Usage
**Tags:** documentation
**Created:** [May 3, 2024, 3:26pm UTC](https://discourse.julialang.org/t/filter-in-function-docstrings/113795 "2024-05-03T15:26:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)
#### Post date: [May 3, 2024, 3:26pm UTC](https://discourse.julialang.org/t/filter-in-function-docstrings/113795/1 "2024-05-03T15:26:13Z")

</div>

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?

````julia
```#
      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;`.

---

<div class="post-metadata">

### Author: ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)
#### Post date: [May 3, 2024, 3:36pm UTC](https://discourse.julialang.org/t/filter-in-function-docstrings/113795/2 "2024-05-03T15:36:57Z")

</div>

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

This works:

```julia
jldoctest ;filter = ... 

```

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

```julia
jldoctest; filter = ...

```

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

---

<div class="post-metadata">

### Author: ![kimikage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kimikage/32/14534_2.png) [@kimikage](https://discourse.julialang.org/u/kimikage)
#### Post date: [May 5, 2024, 8:51am UTC](https://discourse.julialang.org/t/filter-in-function-docstrings/113795/3 "2024-05-05T08:51:57Z")

</div>

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](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).
