# Export Markdown.parse?

**URL:** <https://discourse.julialang.org/t/export-markdown-parse/123638>\
**Category:** Internals & Design\
**Created:** [December 9, 2024, 11:13pm UTC](https://discourse.julialang.org/t/export-markdown-parse/123638 "2024-12-09T23:13:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthias314](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Post date:** [December 9, 2024, 11:13pm UTC](https://discourse.julialang.org/t/export-markdown-parse/123638/1 "2024-12-09T23:13:05Z")

</div>

I’ve just discovered `Markdown.parse`, which allows to convert strings to Julia’s MarkDown type. I think this is a very useful functionality. Wouldn’t it make sense to export it or at least make it public?

EDIT: Well, exporting it would lead to conflicts with `Base.parse`. But documenting it and making it public still sounds like a good idea to me.

---

<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:** [December 10, 2024, 6:19am UTC](https://discourse.julialang.org/t/export-markdown-parse/123638/2 "2024-12-10T06:19:03Z")

</div>

[Replace Markdown stdlib with CommonMark.jl · Issue #37337 · JuliaLang/julia](https://github.com/JuliaLang/julia/issues/37337)

So I would recommend using `CommonMark.jl`.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 10, 2024, 12:46pm UTC](https://discourse.julialang.org/t/export-markdown-parse/123638/3 "2024-12-10T12:46:38Z")

</div>

> [@matthias314](#):
>
> But documenting it and making it public still sounds like a good idea to me.

Yes, this makes a lot of sense — it doesn’t make sense to expose `md"...."` (compile-time parsing) but not `Markdown.parse("....")` (runtime parsing). I’m guessing PR would probably be welcome. Just [edit the file here](https://github.com/JuliaLang/julia/blob/42bd79144ea5363ce7cd4c2d5b3785aaecb60f4b/stdlib/Markdown/src/Markdown.jl#L59).

---

<div class="post-metadata">

**Author:** ![matthias314](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Post date:** [December 12, 2024, 3:21pm UTC](https://discourse.julialang.org/t/export-markdown-parse/123638/4 "2024-12-12T15:21:44Z")

</div>

`Markdown.parse` has several methods, some of which appear to be internal. For public use could be `parse(markdown::AbstractString)` and `parse(stream::IO)`. Both methods have a keyword argument `flavor`, which can be `Markdown.julia` (default), `Markdown.common` or `Markdown.github`. If we document the `flavor` keyword argument, then the three flavors also need to be documented and made public. Shall I do this, too?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 12, 2024, 6:55pm UTC](https://discourse.julialang.org/t/export-markdown-parse/123638/5 "2024-12-12T18:55:04Z")

</div>

> [@matthias314](#):
>
> If we document the `flavor` keyword argument, then the three flavors also need to be documented and made public. Shall I do this, too?

Probably? Can be discussed on the PR.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 12, 2024, 7:05pm UTC](https://discourse.julialang.org/t/export-markdown-parse/123638/6 "2024-12-12T19:05:48Z")

</div>

A post was split to a new topic: [Hiding internal methods from methods(f)?](https://discourse.julialang.org/t/hiding-internal-methods-from-methods-f/123783)

---

<div class="post-metadata">

**Author:** ![matthias314](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Post date:** [December 13, 2024, 1:07am UTC](https://discourse.julialang.org/t/export-markdown-parse/123638/7 "2024-12-13T01:07:59Z")

</div>

I’ve created a PR:

> <https://github.com/JuliaLang/julia/pull/56818>
>
> This has been discussed \[on Discourse\](https://discourse.julialang.org/t/export-…markdown-parse/123638).
> 
> I've split the PR into 3 commits:
> 
> \- one for making \`parse\` public and documenting the public methods,
> \- one for renaming the non-public methods to \`\_parse\`,
> \- one for also making the Markdown flavors public.
> 
> This way you can more easily decide what to take and what not.
