Forum:Meta: Markdown in Biostars (now enabled)
5
23
Entering edit mode
9.9 years ago
Ram 44k

I am sure most of us that use GitHub love its text editor. Would it even be remotely possible for Biostars to add github flavored markdown in its text area, for editing posts/answers/comments? Would it be welcomed by the community here?

If it's OK with Istvan, I can definitely help with this task.

meta • 6.5k views
ADD COMMENT
0
Entering edit mode

Put me down as in favor!

ADD REPLY
16
Entering edit mode
8.7 years ago

Markdown editing has been enabled.

Old posts will be parsed into Markdown once we identify all the tricky posts that might break the process Changing the editing to markdown should have taken a lot less time. It is just one of these cases where aiming for a perfect solution became the enemy of good enough.

I mentioned this above, the Markdown library that we use supports the so called "fenced" code blocks. Enclosing code within triple backquotes on separate lines will mark that text as code. This is handy when indenting by four spaces is difficult. Example:

```
cat data.fq | grep "ATGC" | wc -l
```
ADD COMMENT
11
Entering edit mode

Yaaay!

Kermit the frog going yay

ADD REPLY
1
Entering edit mode

Istvan,

The fenced code blocks work as blocks only when indented. When not, even if we do use triple quotes on new lines, the code is rendered formatted as red inline code but within a block.

```
cat data.fq | grep "ATGC" | wc -l
```

vs

cat data.fq | grep "ATGC" | wc -l

======================================================================================

EDIT: Well that backfired splendidly. The reason is, the preview doesn't show you what's actually going to happen.

For example, the preview: Preview_Image

becomes the actual content: Actual_Image

ADD REPLY
0
Entering edit mode

Yes there is a bit of disconnect between what the preview editor shows and what the backend does. These are different libraries actually. Here is also the issue you opened.

https://github.com/ialbert/biostar-central/issues/401

ADD REPLY
0
Entering edit mode

Wow, This is cool. I am surprised with comment box and answer box changes. But where is color highlighting? removed? I am editing this again after submitting, so the code sample option highlighting in red.

ADD REPLY
1
Entering edit mode

Inlined code is red. That is code flanked with text.

Block code is syntax highlighted. Block code is separated by the body text via empty lines:

This is block code
ADD REPLY
0
Entering edit mode

You're the best

ADD REPLY
0
Entering edit mode

Great news! Will you enable the syntax for markdown spoilers?

Seems quite useful for the TL;DR part of posts,

! but not currently working

ADD REPLY
0
Entering edit mode

We are trying to use existing markdown libraries (though we had to patch some code in the current package as well as in the bleach sanitizing library). What this also means is that we use of the features that these libraries already offer. Spoilers do not seem to be supported.

I hope that we can adopt Common Mark and eventually its extensions.

ADD REPLY
2
Entering edit mode
8.8 years ago
A. Domingues ★ 2.7k

I would definitely appreciate using markdown to write posts.

Any news on progress?

ADD COMMENT
2
Entering edit mode
8.8 years ago

I must have missed this post when it was first posted. +1. I definitely support the idea.

ADD COMMENT
2
Entering edit mode
8.8 years ago

I am so down for this, I really dislike this editor that I've put in ...

ADD COMMENT
0
Entering edit mode

I'd quote you on that, but since there's no way to quote in biostars, i'll code block you on that ;-)

No, in all seriousness Istvan, I first found out about Biostars not because of anything bioinformatics-related, but because I was looking for an opensource StackExchange-like Q and A system for my lab. I was a wetlab biologists back then, so I didn't really know the term "Bioinformatics" at all. After looking at a lot of options, and asking around different places, Biostars was unanimously the best. Then I re-found it a year later when I started programming :)

ADD REPLY
0
Entering edit mode

GitHub's new comments editor looks like a fantastic hybrid approach to writing markdown first and supporting toolbar-centric editing second: https://github.com/blog/2097-improved-commenting-with-markdown.

The only problem is I cannot find their code for this, but I'm sure it's available...

ADD REPLY
0
Entering edit mode

So, we implement this, correct? I do not know django, but it looks like an MVC framework, so we'd have to update the views. If you can show me an example, I can work on the others - I have experience with Razor and ASP.NET MVC2, but no open source MVC implementations.

ADD REPLY
0
Entering edit mode

I did actually work it all out for Biostar 3 that was supposed to be released and had markdown by default. I just did not like how the rest of it turned out and got "canned". Let me take a look at my code and truth to be told it is not difficult to move to markdown it just needs about one good days of work. But lately I have a hard time setting that aside - it is not just one typical day, but one with no other interruptions etc.

I made a new github issue and will create a branch for it that will keep tagging this issue as work progresses. Please follow that:

https://github.com/ialbert/biostar-central/issues/399

ADD REPLY
7
Entering edit mode

Migrated the code base to Markdown. So far looks good and fully functional. Will test it more extensively with the real data on Friday and if all looks good will switch over during the weekend.

ADD REPLY
1
Entering edit mode

OK the markdown has been enabled. Various breakage may occur because in general handling user input can be quite challenging.

The markdown library that I am using supports fenced codeblocks. That means you can format code by enclosing the code within lines that contain only triple back quotes ``` This is easier to do than indenting by four spaces.

I am trying some new syntax highlighting that is bioinformatics tool aware, let's see:

bwa mem data.fq
ADD REPLY
0
Entering edit mode

wow, that is very fast! I was bumping it to get the issue back on table, and never expected anything to happen this fast. Thank you!

ADD REPLY
1
Entering edit mode
8.8 years ago
Deepak Tanwar ★ 4.2k

I am also in favor of it!

ADD COMMENT

Login before adding your answer.

Traffic: 1665 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6