Marked 2: render blockquotes with VoiceOver

Hi everyone!

I’m a VoiceOver (screen reader) user. A Markdown syntax for blockquote is >. However, VO do not recognizes that a line is a quote unless I write in following syntax:

> "*Hello*"

How can I change the behavior in Marked 2 so that VoiceOver does detect the following line as a blockquote: > Hello

Do I need to make changes in the preprocessor or maybe CSS? Perhaps, other places?

Marked 2 version: 2.6.38 (1060)

macOS version: Sonoma 14.5

Do you know if it possible @ttscoff ?

Yes, this could be accomplished with a custom preprocessor in Marked, but I’m not sure I fully understand the issue. You’re using Voiceover in Marked, correct? Where it’s already rendered to HTML. So you’re saying that Voiceover doesn’t recognize the html blockquote tag, but treats italicized text as quoted? But only within a block quote? That’s very odd behavior.

If I do understand the above correctly, the change would have to be made via preprocessor, not via CSS or anything like that. You’d just need to locate block quotes and italicize their contents, which would be a relatively simple regular expression that I could help you write.

Yes, I’m using VoiceOver. As far as I know, it’s not Marked’s fault.

VoiceOver is not the best when it comes to rendering blockquotes on the web. Therefore, I wondered if it would be possible to overwrite the behavior. I will gladly take in use a preprocessor to achieve that.

Here’s one for you to test: https://from.ttscoff.me/wrap_em.sh

Make a directory in your home folder called scripts and save that file to it. Then:

  1. Open terminal and run (you can copy paste this):

    chmod a+x ~/scripts/wrap_em.sh

  2. In Marked, open up Preferences and go to the Advanced pane

  3. Under Custom Preprocessor, enter the following:

    • Enable Custom Processor (checked)
    • Path: ~/scripts/wrap_em.sh
    • Arguments: (Leave empty)
    • Automatically enable for new windows (checked)

If you got all that right, it should work when you open a new window. In most themes you won’t be able to see if it’s working or not, you’d have to right click on a block quote element and see if it contained <em> elements as children.

What it does: The script injects some JavaScript that wraps the inner contents of block quotes in <em> tags, which is the same thing that *text* would do in your example. It uses Marked hooks to ensure that the contents are wrapped on each update.

Let me know if it works or what issues you run into.

I ran into a weird case. If the document has a Markdown header and ends with a quote line, e.g., > text, Marked will only render the heading with VoiceOver.

Just for clarity, can you share an example document where this is happening? I don’t think the forum will let you attach a file, might need to share a Dropbox/other file sharing tool link.

I tried other files, and it renders all the content now. However, in my original request, VoiceOver does not announce that it is a quote. Here is an example of the content in the Markdown document:

# The Header

Some text.

> Quote

More text.