How to write Markdown inside HTML in this forum?

First of all, I meant to reply to this post, but it is automatically closed after 1 year. Still, the first post is a Wiki (i.e. anyone can edit it).

I am pretty sure Discourse / WaniKani Community is using markdown-it, although I am not entirely sure which version it is using.

I also have an intention to make this a next post formatting guide, if everyone agrees.

4 Likes

Writing multiple line Markdown inside HTML is easy, as markdown-it explicitly wants to follow CommonMark spec.

Summary of the spec

These are parsed:-

<DIV CLASS="foo">

*Markdown*

</DIV>

These are not parsed:-

<div></div>
``` c
int x = 33;
```
<a href="foo">
*bar*
</a>

As for single line Markdown, I saw markdown=1 being mentioned here, but I can’t really replicate the result with locally installed markdown-it parser.

There are some markdown parsers that allow this though, like showdown.


As for what is already allowed inside single-line HTML:-

<span>**This is a [spoiler]spoiler[/spoiler].**</span>

<div>**This is a not [spoiler]spoiler[/spoiler].**</div>

<span class="spoiler">**Another spoiler style** is not broken.</spoiler>

<span lang="ja-JP">**誤解**</spoiler>

<span lang="zh-CN">**誤解**</spoiler>

This is a spoiler.

**This is a not [spoiler]spoiler[/spoiler].**

Another spoiler style is not broken.

誤解

誤解

2 Likes

To change the wiki, you just look for the orange button/pen in the top right corner. Click on it and then you choose edit.

Best if you add this yourself to get it right! ^^

Great addition!

The Wiki itself if still “alive” while the thread might be dead. I’m not sure there is much need for discussion about the topic itself? but I have no real opinion on the subject I feel.

Edit: I even tried and tested by adding a blank space and saving. Works just fine.

Can you explain to me for my own curiosity why you feel using HTML wrapped Markdown is a useful formatting tool while using Discourse?

Discourse supports both BBCode and Markdown natively parsed, so there’s no need typically to wrap anything. If you know Markdown syntax already you can just use it inline with out any tags needed and works just fine over multiple lines.

Now, when it comes to useful formatting on the forums, you can’t go wrong with \LaTeX

4 Likes

This problem - 📚📚 Read every day challenge - Spring 2022 🌸 🌱 - #281 by polv

<details>
<summary><ruby>Like this?<rt>

[spoiler]かんじ[/spoiler]

</rt></ruby></summary>

That's right. 

</details>

Though, there already exists an easy solution

<details>
<summary><ruby>Like this?<rt><span class="spoiler">かんじ</span></rt></ruby></summary>

That's right. 
</details>

Still, think if you want something else more complex…

2 Likes

Rather, @Joeni, why haven’t you made and added a Latex guide in the Wiki to let us lesser folks in on the secret? :eyes:

This isn’t a either or, but eat all the cake scenario!

I’d love to see that helpful guide expanded!

4 Likes

You might also find this helpful, to avoid having to manually code stuff like that:

1 Like

Real failure case, then

This is very important, according to @polv

That’s right. Some few things that can only be inserted with native markdown.

1 Like

\color{blue} **<i>yellow</i>**^{2}​

You can’t really use Markdown or even HTML either, inside LaTeX. Although, it technically compiles down to HTML.

Also, quoting breaks for some reasons, but bracing for LaTeX is $ \LaTeX $.

I originally learnt LaTeX from R programming language (RMarkdown), and there is a parser that includes it by default (Markdown Preview Enhanced).

Still, it is supposedly dialect-dependent (various versions of LaTeX, which is indeed just like Markdown). That’s why I tried to learn ConTeXt a while ago too.

It appears that certain HTML tags already allow Markdown.

誤解
Another spoiler style is not broken.

誤解にゃにー
誤解 :lollipop:

But <summary> is not one of them. (And <div> has been demoted.)

誤解 **Another spoiler style** is now broken. :lollipop:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.