# Does Markdown support comments?

**URL:** <https://discourse.julialang.org/t/does-markdown-support-comments/37607>\
**Category:** General Usage\
**Tags:** question, markdown\
**Created:** [April 15, 2020, 2:16am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607 "2020-04-15T02:16:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![KDr2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdr2/32/2542_2.png) [@KDr2](https://discourse.julialang.org/u/KDr2)\
**Post date:** [April 15, 2020, 2:16am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/1 "2020-04-15T02:16:22Z")

</div>

I am writing docs for a package, using Emacs, and I want to put some file local variables in the markdown files, I tried:

```markdown
[//]: # -*- mode: auto-fill -*-
<!-- -*- mode: auto-fill -*- -->

```

But these lines are not recognized as comments and are put into the generated HTML files.

Is there a way to write comments is the markdown file? Thanks.

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [April 15, 2020, 2:27am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/2 "2020-04-15T02:27:42Z")

</div>

Looks like there’s an answer here: [syntax - Comments in Markdown - Stack Overflow](https://stackoverflow.com/questions/4823468/comments-in-markdown)

---

<div class="post-metadata">

**Author:** ![KDr2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdr2/32/2542_2.png) [@KDr2](https://discourse.julialang.org/u/KDr2)\
**Post date:** [April 15, 2020, 2:42am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/3 "2020-04-15T02:42:32Z")

</div>

I tried the methods in this link, none of them works:

```julia
julia> using Markdown

julia> md = md"""
             [comment]: <> (comment 1)

             [//]: <> (comment 2)

             [//]: # (comment 3)

             <!-- comment 4 -->
             """;

julia> html(stdout, md)
<p>&#91;comment&#93;: &lt;&gt; &#40;comment 1&#41;</p>
<p>&#91;//&#93;: &lt;&gt; &#40;comment 2&#41;</p>
<p>&#91;//&#93;: # &#40;comment 3&#41;</p>
<p>&lt;&#33;– comment 4 –&gt;</p>

julia>

```

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [April 15, 2020, 3:42am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/4 "2020-04-15T03:42:01Z")

</div>

Are you using Documenter.jl? They have the syntax `# hide` to hide some forms of contents.

---

<div class="post-metadata">

**Author:** ![KDr2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdr2/32/2542_2.png) [@KDr2](https://discourse.julialang.org/u/KDr2)\
**Post date:** [April 15, 2020, 4:23am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/5 "2020-04-15T04:23:23Z")

</div>

I think `#` leads a section title in markdown…

And `# hide` is only designated for use in a code/example block according to [Syntax · Documenter.jl](https://juliadocs.github.io/Documenter.jl/stable/man/syntax/#@example-block-1).

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [April 15, 2020, 6:31am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/6 "2020-04-15T06:31:52Z")

</div>

File-local variables should work with the following syntax according to the author of markdown-mode:

> **[File Local Variables in Emacs and Markdown Mode](https://jblevins.org/log/file-local-variables)**
>
> How to use file local variables in Emacs generally, and specifically in Markdown Mode.

---

<div class="post-metadata">

**Author:** ![KDr2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdr2/32/2542_2.png) [@KDr2](https://discourse.julialang.org/u/KDr2)\
**Post date:** [April 15, 2020, 7:07am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/7 "2020-04-15T07:07:23Z")

</div>

@Tamas_Papp

Thank you for replying , but I think you misunderstood what we are discussing.

We talking about the `markdown` format, as well as the `Markdown` module in the Julia stdlib. mostly the later one.

There’re many markdown tools that can convert markdown to HTML, including Julia’s `Markdown` module. Most of them support embedding comments in a certian syntax, like what was mentioned in the link @Mason provided.

But all these syntaxes don’t work with Julia’s `Markdown` module, I wonder if there’s a syntax work well with Julia’s `Markdown` module so that I can put some local variables into my md files. I tried the methods in the link you post, none of them works either ( **They set the local varables, but they are not comments to Julia’s `Markdown` module** ).

Also, I think this is not an offtopic thread…

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [April 15, 2020, 7:09am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/8 "2020-04-15T07:09:42Z")

</div>

Sorry for misunderstanding, I have put back the topic in Usage.

If you are generating docs using Documenter.jl, you may want to ask about comments in an issue there.

---

<div class="post-metadata">

**Author:** ![KDr2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdr2/32/2542_2.png) [@KDr2](https://discourse.julialang.org/u/KDr2)\
**Post date:** [April 15, 2020, 7:14am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/9 "2020-04-15T07:14:20Z")

</div>

Never mind, I now created a directory local variable as a work-around:

```julia
$ cat .dir-locals.el
((markdown-mode
  (eval auto-fill-mode)))

```

But it will be better if the `Markdown` module supports comments in markdown text.

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [April 15, 2020, 7:45am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/10 "2020-04-15T07:45:09Z")

</div>

> [@KDr2](#):
>
> But it will be better if the `Markdown` module supports comments in markdown text.

Please file an issue on GitHub then. Otherwise it’s unlikely that this will happen any time soon (not promising that it will if you do, of course 😃 ).

---

<div class="post-metadata">

**Author:** ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Post date:** [April 15, 2020, 8:06am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/11 "2020-04-15T08:06:43Z")

</div>

it’s a natural suggestion but note that the Markdown module is not trivial, there’s a few open issues (OTOH treatment of lists over several lines and reflinks) that have been open for a long time.

In this particular case it would seem that adding a block similar to “Quotes” could do the trick ([julia/block.jl at 0cd77ddd05a7c9d9c03a38d8e06bbddecb1ad908 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/blob/0cd77ddd05a7c9d9c03a38d8e06bbddecb1ad908/stdlib/Markdown/src/Common/block.jl#L163-L186))

---

<div class="post-metadata">

**Author:** ![KDr2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kdr2/32/2542_2.png) [@KDr2](https://discourse.julialang.org/u/KDr2)\
**Post date:** [April 20, 2020, 6:49am UTC](https://discourse.julialang.org/t/does-markdown-support-comments/37607/12 "2020-04-20T06:49:11Z")

</div>

> [@carstenbauer](#):
>
> Please file an issue on GitHub then. Otherwise it’s unlikely that this will happen any time soon (not promising that it will if you do, of course 😃 ).

[Markdown: add ability to not escape html characters in markdown · Issue #35523 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/35523), I think this one is fine to cope with the situation ☀
