Use markdown in blurb

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 20:18:05 -07:00
parent 937c19c141
commit 14dd4f24c2
2 changed files with 7 additions and 10 deletions

View File

@ -1,6 +1,10 @@
---
title: "Open An IEx Shell From An Elixir Script"
blurb: "We can run an Elixir script with either the <code>elixir</code> or the <code>iex</code> command. Both will execute the code, but the second command opens an interactive IEx shell afterward. What if, we won't know until runtime whether we want a shell or not? How can we start an IEx session even when we use <code>elixir</code>, instead of <code>iex</code>, to run our script?"
blurb: "We can run an Elixir script with either the `elixir` or the
`iex` command. Both will execute the code, but the second command
opens an interactive IEx shell afterward. What if, we won't know until runtime
whether we want a shell or not? How can we start an IEx session even when we
use `elixir`, instead of `iex`, to run our script?"
...
I recently had occasion to want to start an IEx session from an Elixir script. Here's how I was able to do it.

View File

@ -17,15 +17,8 @@ Site.config.out_dir = "html/"
rend = "renderers.markdown"
require(rend).cmd = "pandoc --mathjax >"
-- Replace the default markdown renderer with our custom renderer
-- TODO we shouldn't remove it because it is still searched for in some places
-- example https://github.com/leafo/sitegen/blob/ac9b7c199ed7adb32064b056a438cbaed8c71d23/sitegen/renderers/html.moon#L53
-- Site.default_renderers = for v in *Site.default_renderers
-- if v\find "markdown" then rend else v
table.insert Site.default_renderers, 1, "renderers.markdown"
p Site.default_renderers
-- Insert custom renderer in the first position so it will be preferred
table.insert Site.default_renderers, 1, rend
-- Remove "pygments" plugin because it conflicts with pandoc syntax highlighting
Site.default_plugins = for v in *Site.default_plugins