# Raw HTML in docstring

**URL:** <https://discourse.julialang.org/t/raw-html-in-docstring/95491>\
**Category:** General Usage\
**Tags:** documenter, html\
**Created:** [March 3, 2023, 11:42am UTC](https://discourse.julialang.org/t/raw-html-in-docstring/95491 "2023-03-03T11:42:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedromxavier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pedromxavier/32/47385_2.png) [@pedromxavier](https://discourse.julialang.org/u/pedromxavier)\
**Post date:** [March 3, 2023, 11:42am UTC](https://discourse.julialang.org/t/raw-html-in-docstring/95491/1 "2023-03-03T11:42:24Z")

</div>

I’m using Documenter.jl to generate online docs for my package. I want to include raw HTML in a method docstring such as:

````julia
@doc raw"""
    my_method(x, y)

This is my method. Now some raw HTML:

```@raw html
<svg style="display: block; margin: 0 auto;" width="5em" heigth="5em">
    <circle cx="2.5em" cy="2.5em" r="2em" stroke="black" stroke-width=".1em" fill="red" />
</svg>
```
"""
function my_method(x, y)
    return x + y
end

````

After adding `my_method` to a `@docs` block in the `index.md` file, the raw HTML block shows up as code, HTML-escaped in a `<pre>` block, instead of being included verbatim in the HTML source.

The raw block renders correctly (a red circle) if used outside of a docstring.

---

<div class="post-metadata">

**Author:** ![woclass](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/woclass/32/212699_2.png) [@woclass](https://discourse.julialang.org/u/woclass)\
**Post date:** [March 4, 2023, 4:20am UTC](https://discourse.julialang.org/t/raw-html-in-docstring/95491/2 "2023-03-04T04:20:00Z")

</div>

> [@pedromxavier](#):
>
> Documenter.jl

The `@raw html` syntax is valid in markdown.

> <https://github.com/JuliaDocs/Documenter.jl/blob/88ed15a8420c0a87f81c9d7514356deb2f4c1933/docs/src/man/syntax.md?plain=1#L734-L739>

Supported syntax in the comments of functions:  
[https://docs.julialang.org/en/v1/manual/documentation/#Syntax-Guide](https://docs.julialang.org/en/v1/manual/documentation/#Syntax-Guide)

---

<div class="post-metadata">

**Author:** ![pedromxavier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pedromxavier/32/47385_2.png) [@pedromxavier](https://discourse.julialang.org/u/pedromxavier)\
**Post date:** [March 10, 2023, 9:52pm UTC](https://discourse.julialang.org/t/raw-html-in-docstring/95491/3 "2023-03-10T21:52:54Z")

</div>

The problem is that it is only valid at top-level, not inside function docstrings.

---

<div class="post-metadata">

**Author:** ![mortenpi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mortenpi/32/158_2.png) [@mortenpi](https://discourse.julialang.org/u/mortenpi)\
**Post date:** [March 11, 2023, 3:33am UTC](https://discourse.julialang.org/t/raw-html-in-docstring/95491/4 "2023-03-11T03:33:03Z")

</div>

That’s intentional, since docstrings should be plain Markdown. E.g. the REPL is not capable of rendering Documenter’s at-blocks.
