Discount Markdown Processor

I know there are a lot of flavors of Markdown, and everyone in the community doesn’t necessarily use it, but I thought I’d see if anyone had an idea about the issue I’ve run into. :grinning:

Has anyone tried using the “Discount” markdown processor? I’m using Discount (not MultiMark) in Marked2 as the processor and wanted to set the same processor in Tinderbox for times when I would like a quick preview. For the most part, it is working well; however, I ran into one issue. Code Fence isn’t working in Tinderbox even after applying the below flag.

I wonder if I am doing something wrong or if there is some conflict in Tinderbox.

Links (for reference or in case anyone else would like to install it as an alternative Markdown processor)

Discount Markdown Site
Homebrew Formulae Page

Note Text and HTMLPreviewCommand

Note Preview

Flag refer to Discount Markdown Site

MKD_FENCEDCODE - Enable Github-style fenced code blocks.

I think you have two issues.

  1. the path to the discount is wrong, in terminal try brew --prefix discount to check the path.
  2. the path does not have permission to run; at least that is the error I got. I need to talk with @rtalexander to get help on what to do in this case. I’m out of my depth.

Type the following in to a command prompt (terminal) and message me the out:

ls -l /usr/local/cellar/discount/2.2.7b/bin/markdown

The output will tell us who has permission to execute markdown.

Dear Roger Alexander,
I would like to try your discount package, but brew info shows
this message.

brew info discount
==> discount: stable 2.2.7b (bottled), HEAD
C implementation of Markdown
Conflicts with:
markdown (because both install markdown binaries)
multimarkdown (because both install markdown binaries)

How can I avoide those conflict possibilities ?
Very truly yours, WAKAMATSU from Japan


I worked with Roger separately, and there isn’t an issue with the path or permissions.

@rtalexander Thanks again!

Here are some more screen captures on another test. Hoping it might help.

Tinderbox Text

Tinderbox Preview

Tinderbox Export

Marked2 Render

What exactly does Discount expect to be passed to it?

Here is what is on the Discount site detailing what to expect when enabling the MKD_FENCEDCODE flag

So, I grabbed some example text from GitHub Flavored Markdown Spec site. Assuming this would be the safest way to ensure I was formatting things correctly.

I’m adding in a new test with captures from both Tinderbox and Marked.

Marked2 with Discount processor set with Discount (GFM)


Tinderbox Text

Marked2 Render

Tinderbox Preview

Tinderbox Export

Marked2 Source

I hope this helps. Let me know if you need anything else.

This is not the right way to approach this problem.

I suggest the following:

  1. Make a text file with some fenced code which you think Discount will process in the way you want.

  2. Use your command line from the Terminal to send it to Discount, and then check to see that the result is what you expect.

  3. Now that you’ve done that, adjust your Tinderbox template to generate the file you created in step 1.

1 Like

Thanks for the advice; I’ll give it a try!

A few points of clarification. Isn’t Discount or any Markdown processor converting the Markdown to HTML? If so, if both Marked and Tinderbox are now using Discount, and I’m providing the same input in the note, why is one working and the other not? So, I’m confused about why I would need to change the format. I can understand using the command line to see if Discount processes it correctly locally. This makes sense as the next logical troubleshooting step to eliminate Discount’s local install as the point of failure. But if it processes correctly, wouldn’t that mean a conflict in Tinderbox prevents a proper preview?

Let me know if I’ve misunderstood the flow, etc. I want to get things working, but I’d also like to make sure I understand the nuts and bolts of how things are being processed. I appreciate your patience!


I ran Discount from the command line, and the output is the same as when it is run from Tinderbox. It doesn’t appear that the flag MKD_FENCEDCODE to enable Github-style fenced code blocks isn’t working. So, I’m back to wondering if I’m setting the flag correctly, do I need to do something else, or does Discount have a bug? :frowning_face:

I know this topic is not something everyone is interested in, and there are other options, so I appreciate the assistance I’ve received so far. :smiley:

The “fenced code blocks” doc you screenshotted upthread says blocks are wrapped in ~~~, not ```. For what it’s worth.

1 Like

Good call out! I also saw that when re-reviewing the doc during testing in the Command Line last night.

If called with the MKD_FENCEDCODE option, Pandoc-style fenced code blocks are supported; blocks of code wrapped in ~~~ lines are treated as code just as if it was indented the traditional 4 spaces. Github-flavored-markdown fenced code blocks (blocks wrapped in backtick lines) are also supported.

So I tried both ~ and ` last night. In both Tinderbox with Discount or in the Command Line, using ~ treats the text as strikethrough, not fenced code.

That is why I wrote, “I’m back to wondering if I’m setting the flag correctly, do I need to do something else, or does Discount have a bug? :frowning_face:” last night.

At least I’ve learned a few things exploring this, even if they weren’t exactly related to solving this problem. So the journey continues… :wink:

1 Like

This journey has come to a successful end. :smiley:

I thought I’d post this in case others wanted to use the Homebrew Discount markdown formulae in the future and get stuck with setting flags.

So, as I mentioned in my earlier posts, the basic installation seems to work properly for all the typical GFM features. However, the only issue I ran into was that the basic configuration had the fenced code turned off. As I thought the cause of my problem was that setting the flags wasn’t working. Unfortunately, the flag documentation on the site doesn’t apply to the Homebrew formulae. So, to enable it, I had to use the flag: -f fencedcode. Now both ` and ~ can be used for fenced code and it also works with the class extension if added.

Now, everything displays as it does in Marked2, minus the styling, which I’ll tweak as needed.

Cool. Can you share a screenshot of what the fenced code looks like?

Also, has anyone else run into this issue. I’m unable to install both discount and multimarkdown formulae. I get a homebrew error. Anyway to have both packages installed?

Have you tried
To go around privileges right-click .pkg and select Open with → Installer.

1 Like


I haven’t styled it yet, but here is a plain vanilla example.

Tinderbox Note


Tinderbox Preview


Marked2 Preview Stream

Two Markdown Installs

I would suggest something similar to @gul-iMac - a standalone install for either. Another option I haven’t tried, but I believe you can also unlink and relink Homebrew packages when there are shared dependencies. I elected to uninstall MultiMarkdown, since I “currently” plan on only using Discount.

1 Like

Dear tbx1513,

I got it, Tinderbox Preview, Marked 2 Preview Stream,
Using discount and multimarkdown package.

In multimarkdown, quoting “-F” and “MKD_FENCEDCODE” in -F MKD_FENCEDCODE
I got the above error in Tinderbox’s Note1Preview.
I followed the instructions to remove this addition and compiled the result.

The result was exactly the same as in discount markdown.

In order to run this test, I had to “unlink” some of the files from brew to avoid conflicts.
I was instructed to “unlink” one of them, so this time I
The one who tested the discount first was “brew unlink discount”, and
I have restored the multimarkdown that was unlinked before the test by “brew link multimarkdown” and run the second test.
and then run the second test.
It was not a big deal,
I am just reporting on the follow-up test.
Sincerely yours, WAKAMATSU
I’ve only had emacs & spacemacs 28 compile with multimarkdown so far.
For the time being, I intend to use multimarkdown, although it differs from yours.
I would be very grateful if you could continue to tell me the advantages of using discount packages.
Using ~ on the command line treats the text as a strikeout, not a fence code.
I confirmed that this is more correct using discount package.
discount with ~~~ preview
discount with ~~~tbx


In one of my recent posts, I wrote about properly setting the Fenced Code flag; see below. :smiley:

Regarding Multimarkdown versus Discount features, I think either is fine based on personal preference. As has been said in the forum, many are fine with CommonMark. So, there are many views and no one size fits all. I like some of the nuances with GFM and Discount. Maybe you can try both and see what fits your needs best? :wink:

I hope this helps!

Dear tbx1513,
Thank you for your response.
This report confirms that the use of “~~~~” works the same as “````”.

But why does multimarkdown not use “-F MKD_FENCEDCODE”?
The “-F MKD_FENCEDCODE” cannot be used.
libMultiMarkdown: invalid option “-F” Try ‘multimarkdown --help’ for more information. /bin/sh: line 3: ~~~~ruby: command not found /bin/sh: line 4: syntax error near unexpected token (' /bin/sh: line 4: def foo(x) ’

The use of ~~~' is not recognized as a command by ruby. Even with ````'', the flag for ``MKD_FENCEDCODE'' or ``-f fencedcode'' is not recognized as a command by ruby. Error reading file 'fencedcode' /bin/sh: command substitution: line 8: syntax error near unexpected token (’ /bin/sh: command substitution: line 8: ` def foo(x) ’
I will get an error like this with Tinderbox9.5.2.
I assume this is an “essential” flag when you use the “discount” package.
What kind of “addendum” would work properly for multimarkdown?
Any guidance would be greatly appreciated.



Oh, I understand now. I haven’t looked into MultiMarkdown’s flags and features (e.g. fenced code), etc. Each processor’s flags and features will be unique. You might want to post a separate question in the forum, and someone might have the answer for MultiMarkdown’s since I don’t have it installed.