Markdown syntax for FormattedString?
-
Writing down this issue which wonders about the possibility of semantically embedding a URL into running text (without actually showing that URL) made me think of how useful Markdown syntax in the context of a FormattedString could be.
Has anyone tried something like it?
I assume I could write something which regex-parses a given text for
.md
formatting, and then applies different formats depending on the match. Small bits of FormattedString could be chained into a big FormattedString – voilà, formatted text.
However, while this approach addresses the simple visual variants available within the world of Markdown, it does not solve the original ”how to invisibly embed a URL link within text” (which Markdown is good at).
-
pageBot can do this...
-
a possible solution:
https://gist.github.com/typemytype/61976b9fde748807ec7fcd620788f0d5
-
I hope you don’t mind me reviving this...I’ve been trying to work with @frederik’s gist from march, and cannot seem to get beyond this error after installing markdown using the package manager. Usually I would just ascribe this to my weird python setup, but since Drawbot is its own self-contained universe, I wonder if there is something obvious I am missing?
Drawbot Version 3.126, MacOS 10.15.7 (19H2)
Many thanks!
Traceback (most recent call last): File "<untitled>", line 72, in <module> File "<untitled>", line 14, in appendMarkdown File "/Users/david/Library/Application Support/DrawBot/Python3.7/markdown/__init__.py", line 29, in <module> File "/Users/david/Library/Application Support/DrawBot/Python3.7/markdown/core.py", line 27, in <module> File "/Users/david/Library/Application Support/DrawBot/Python3.7/markdown/preprocessors.py", line 29, in <module> File "/Users/david/Library/Application Support/DrawBot/Python3.7/markdown/htmlparser.py", line 31, in <module> AttributeError: 'zipimport.zipimporter' object has no attribute 'exec_module'
-
hello @djrrb,
I think this error was introduced in markdown 3.3 (new htmlparser).
I don’t know how to fix it, but you can install an earlier version of markdown which still works:
pip install markdown==3.2.2
cheers
-