
bradleyscollins
Powerful Command-Line Applications in Go: blackfriday Library Not Working? (pp. 50, 52)
Problem
As I am working my way through the book today in August of 2024, it appears that blackfriday
(v2.1.0) no longer works. In particular, even configuring it explicitly with the common set of extensions, it does not produce an HTML list from either a bulleted or numbered markdown list.
Case in point, given the content of test1.md
(p. 52):
# Test Markdown File
Just a test
## Bullets:
* Links [Link1](https://example.com)
## Code Block
```
some code
```
… it renders the Bullets section of the markdown this way:
<h2>Bullets:
</h2>
<p>
* Links <a href="https://example.com" rel="nofollow">Link1</a>
</p>
… when it should be something more like this:
<h2>Bullets:
</h2>
<ol>
<li>Links <a href="https://example.com" rel="nofollow">Link1</a></li>
</ol>
Solution
I have replaced blackfriday
with markdown
(v0.0.0-20240730141124-034f12af3bf6 as of this writing), and it is working like a charm. It requires just a one-line change to the parseContent
function (p. 50):
# output := blackfriday.Run(input) # replace with the line below
output := markdown.ToHTML(input, nil, nil)
It produces the expected output:
<h2>Bullets:</h2>
<ul>
<li>Links <a href="https://example.com" rel="nofollow">Link1</a></li>
</ul>
First Post!

LeamHall
Hey @bradleyscollins ! I just did this run this morning and blackfriday worked find for me. The “links” was marked up nicely.
Here’s the line from my go.mod file, if it helps diagnose the issue:
http://github.com/russross/blackfriday/v2 //indirect
Popular Pragmatic topics










Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /js
- /rails
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /opensuse
- /ash
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /react-native
- /textmate
- /sublime-text
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /nodejs
- /lua
- /slackware
- /julia
- /c
- /neovim