But that’s my question: can I do in Markdown what Markdown is capable of, and when I want to do something that Markdown is not capable of, switch to HTML/X-expressions?
In particular, I’d like to be able to insert links into example source code, which I can do in pre but not with Markdown.
In the Markdown dialect of Pollen, any in-line Racket code is first evaluated, the results get converted to strings, and then the whole thing is sent through the Markdown parser as the final step. Which means that ultimately, you cannot get a more “featureful” structured document out of the process than the Markdown parser is capable of producing. X-expressions in particular are also converted to strings, and these strings have no significance to the Markdown parser, which will just try and apply its “smart” typography to the single/double quotes in the string representation of the list.
In your example:
#lang pollen
◊strong{foo}
# some title
The value strong isn’t bound to anything. In the Pollen environment, when you reference a binding that doesn’t exist, Pollen creates a procedure for it, and then calls that procedure with the arguments you gave ("foo"). That results in the value '(strong "foo") (see default-tag-function) which is what the Markdown parser sees.
If you have a pollen.rkt saved in the same folder, you can define strong yourself and Pollen will make use of it:
This discussion on the old pollen-users repo has some more good pointers on this issue too.
In particular, there is the HTML-in-Markdown hack that I thought of (second-to-last comment in that issue). I forgot about that until after I submitted my first reply above.