This is in regard to an issue posted by @Sealfur in the Marked support site. The CriticMarkup preview is appearing blank, despite python3 being installed on the system.
What I’d like to try is just running the criticmarkup script directly from the command line and seeing what results it outputs. The script is located at:
Substituting the path to your test Markdown file for PATH. You can easily insert the path to your file by dragging the file from Finder to Terminal with the cursor positioned where you want the path inserted.
Ah, this is interesting.[1] It gives me mostly markdown but the CriticMarkup is now rendered in html.
# The CriticMarkup Syntax
The CriticMarkup syntax is fairly straightforward. The key thing to remember is that CriticMarkup is processed _before_ any other MultiMarkdown is handled. It's almost like a separate layer on top of the MultiMarkdown syntax.
When editing in MultiMarkdown Composer, you can have CriticMarkup syntax flagged in the both the editor pane and the preview window. This will allow you to see changes in the HTML preview.
## Deletions from the original text:
This is <del class="crit">could be</del> a test.
## Additions:
This <span style="display:none"></span><ins class="crit">is </ins>a test.
## Substitutions:
This <del class="crit" data-subout="sub1">isn't</del><ins class="crit" id="sub1">is</ins> a test.
## Highlighting:
This is a <mark class="crit">test</mark>.
## Comments:
This is a test<span class="critic criticcomment">What is it a test of?</span>.
(It’s 1am in Melbourne, but I can do any further steps tomorrow.)
<musings> Thinking about this and it starts to make sense to me. I wonder if I have the process correct:
Marked 2 renders Markdown. That’s its job and it does it well.
For UI purposes, the Markdown is converted to html so that formatted documents can be viewed on-screen. But the original Markdown is always sitting under there, waiting to be converted to another output format.
CriticMarkup is a whole other syntax that needs to be parsed.[1]
markedcritic.py processes CriticMarkup before passing the document to the Marked 2 memory. That’s why in the cat output I see the html tags around the proofing changes.
But… if markedcritic.py puts out the correct combination of Markdown and inline html, (which, saved as a new file I can view normally in Marked 2) what’s blocking the render in the CriticMarkup view?
Sometimes I wish I’d done CompSci at uni so I could help with things like this. But if you ever need to troubleshoot some CSS, hit me up. </musings>
I note, also, that the original website now just 301s to the toolkit repository. ↩︎
I ran into the problem yesterday when I updated (via App Store) to 2.6.44, which I did mainly because the version I had (sorry, I don’t know the number) was not processing the CriticMarkup at all, just passing it unchanged to the preview.
Symptoms are as reported by @Sealfur: a file with CriticMarkup renders fine when CriticMarkup is disabled but is totally blank when I enable it; the three tabs are displayed – all blank; word count shows the correct number of words, in fact all the stats, including readability, are displayed even though the contents of the file are not .
I can confirm that when the preprocessor is run in isolation I get the expected output, consisting of the markeddown text, with the CriticMarkup converted to HTML elements.
Furthermore, if I toggle source view, I can see all the HTML content and converted CriticMarkdown, but when I export as HTML, I get an empty file.
Is there some CSS or JavaScript messing about with it? Changing to a different style didn’t help, so it’s not in there.
This feature was working a treat the last time I used it in a project, which seems to have been three or four years ago (which doesn’t give a very precise indication of when the bug was introduced, I’m afraid).
I’m running MacOS 12.7.6 on an elderly Intel MacBook Air. Maybe that’s part of the problem if this hasn’t been widely reported.
The word count business is not quite as it seemed. If I have CriticMarkup disabled, the count is shown correctly. If I then enable it, the count remains the same in the Markup tab, If I switch to either of the other tabs, detailed stats shows only 2 characters. If I then switch back to the Markup tab, I now see just 2 characters there too. Disabling CriticMarkup brings back the correct count.
I haven’t made any progress on solving this yet, as it’s working fine for me and is very hard to diagnose if I can’t replicate.
Knowing you’re on macOS 12 is helpful, as a lot of the current functionality depends on the python location on more recent systems. I might be able to replicate if I can set up an emulator for 12.
Adding this back to my list of bugs to address as soon as I can.
Python on my system is at /usr/local/bin/python3 apparently.
The python command is unknown, but
python3 --version tells me it’s Python 3.11.2.
Final bit of information (I hope): I have an old iMac running MacOS 10.13.6 High Sierra, with Marked2 2.5.35, and CriticMarkup support works properly there, so that’s a lower bound on when the trouble started and a fallback for me if I have to.
Sorry for the delay on getting back to this. I haven’t been able to get a test environment set up for the older OS, so I don’t know if that’s an issue.
I think you’re on the right track with wondering if CSS/JavaScript is messing with the preview somehow. The fact that the source view shows it correctly means the right markup is being passed to the preview, but something must be happening before display. Could you right click on the blank preview and select “inspect” and see if there’s any indication in the inspector that the content is there but not visible?
Nothing there, except the Marked boilerplate. There’s nothing inside div#wrapper, which the box model diagram shows with height=0. Its class is set to criticmarkup; I couldn’t see anything dubious in the CSS for that. I didn’t delve into the JavaScript. I tried turning on debug mode, but there were only informational messages in the console, no errors or warnings.
While poking about with the py script, I noticed that everything in the Marked 2 package is owned by root. I confess that I’ve never entirely understood how permissions on executables in MacOS work. Is that what you would expect? (I got it from the app store, so I would hope it installed in a sensible way.)
You’ll find root permissions in pretty much every app bundle. I believe this is a newish development with the advent of app signing.
My only guess is that something in the JS is eating the content, but I can’t replicate here so it’s going to be just me reviewing every step to see if there’s anything that could cause that. Will be a slow process. Might have time to do it over my 4-day weekend.
I wouldn’t want you to lose your long weekend on my account. I can live without it if I have to.
I think you need to bear in mind that it only seems to be failing for a couple of people here, so it’s more likely, isn’t it, to be something in the environment.
As I mentioned before, 2.5.25 works fine, so if it’s something you did, you should be able to track it down with that git thing for finding changes in the relevant bit of code.
Anyway, please don’t spend too much effort on this. It’s something that would be nice to have, not essential. Marked still does an excellent job at everything else.
Honestly, poring through and writing code is what I like to do with long weekends :).
I think you’re referring to git bisect which is amazing if you can replicate the problem, splitting the code until the problem no longer manifests and narrowing down which code might be responsible. But it doesn’t do much good if you can’t tell when the problem goes away, unfortunately.
Just for my testing, could you share a Markdown document with CriticMarkup that’s failing for you? I understand that ALL docs might be failing, I just want to ensure that I’m working with the same things you are. This applies to both @MacAvon and @Sealfur. Thanks!
The actual files I’ve been looking at are unpublished things I’d rather not share, but I put together a dummy document which shows the behaviour fine. Only trouble is, when I try to upload it here on the forum, it won’t let me – it only shows image files. This link might work:
In fact, any document will disappear as soon as I press ctl-shift-C, whether it has any critic markup in it or not.
Oh, that’s somewhat intersting.Will dig in. And sorry I haven’t figured out how to allow file attachments yet… maybe that’s something Discourse can’t do?