Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown: Code block is not properly generated #170

Open
carlosen0153 opened this issue Mar 8, 2022 · 4 comments
Open

Markdown: Code block is not properly generated #170

carlosen0153 opened this issue Mar 8, 2022 · 4 comments

Comments

@carlosen0153
Copy link

My computer is running Debian 10 and I installed markdown (apt install markdown). I am using bashblog (commit 1715ee1) and in genreal works well using markdown. However, if I insert the following code block

```
int compute_sum(const vector<int> &vec)
for (int i=0; i<vec.size(); ++i)
sum += vec[i];
return sum;
```

when posting the code block is displayed a single line.

@obsd-guru
Copy link

i also wrote a similar issue just a few days ago. #169 . but sadly no answer to it.

@Lex-2008
Copy link
Contributor

It's an issue with markdown, and there's not much bashblog can do (apart from creating its own markdown). apt install markdown installs this package: https://packages.debian.org/buster/markdown - which uses this implementation: https://daringfireball.net/projects/markdown/ (rightside bar, "External Resources" - "Homepage). If you switch to "syntax" tab, then under "code blocks" it says that:

To produce a code block in Markdown, simply indent every line of the block by at least 4 spaces or 1 tab.

It would be cool if bashblog supported Pandoc or CommonMark, but that's up to @cfenollosa to decide.

Alternatively, a possible workaround might be to uninstall markdown, install CommonMark, and symlink CommonMark executable to Markdown.pl

@panki27
Copy link

panki27 commented Oct 13, 2022

@Lex-2008 thank you for this!
I finally got around to it. Compiling cmark and replacing Markdown.pl with it works.

As I expected, no code highlighting though. Doesn't seem like cmark supports generating CSS to go along.

@Lex-2008
Copy link
Contributor

@panki27 you can consider adding some javascript-based code highlighter. For example, I'm using microlight.js: project page, my blog post. As you can see, it even survived my migration from bashblog! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants