Custom preprocessor fails to load

Jake W's Avatar

Jake W

21 Jan, 2021 05:26 AM

As suggested elsewhere in these discussions I'm trying to enable emoji support via a custom preprocessor.

Anytime I enable the preprocessor option Marked hangs on the loading message.

There is never any output in the "Custom Processor Log", the Debug Log shows the following:

> 2021/01/20 21:21:00:606 | ===> UTI found for test.md: net.daringfireball.markdown
> 2021/01/20 21:21:00:652 | Processing document [2021-01-21 05:21:00 +0000]
> 2021/01/20 21:21:00:652 | file:///Users/smee/Desktop/test.md opened with encoding 4
> 2021/01/20 21:21:00:652 | Loading test.md succeeded
> 2021/01/20 21:21:00:652 | Checking for includes
> 2021/01/20 21:21:00:652 | Extracting scrippets
> 2021/01/20 21:21:00:654 | Extracted 0 scrippets
> 2021/01/20 21:21:00:654 | Inserting included files (processed) from file:///Users/smee/Desktop/
> 2021/01/20 21:21:00:664 | Executable is available
> 2021/01/20 21:21:00:664 | Processing using custom preprocessor
> 2021/01/20 21:21:00:664 | Launching pre-render task

I seem to get the same result regardless of my preprocessor, even /bin/cat causes the same result.

This is my first stab at this, so it's not unlikely I've completely missed something. Any help would be much appreciated 

  1. Support Staff 1 Posted by Brett on 21 Jan, 2021 11:55 AM

    Brett's Avatar

    First, please include the results of Help->Report an Issue, as that will answer some of the initial questions I have.

    First questions, though: if you run a ‘cat file.md|yourscript.ah’ on the command line, do you get the expected result?

    Does your script have a shebang at the top?

    Is your script set to executable permissions?

    Answer those for me (or ask for further clarification if needed) and we’ll try to figure it out.

    Might also help to attach the script itself so I can test on my end.

    As a final note, I’ll mention that I just added emoji support, it will be in the next update :).

    - Brett

  2. 2 Posted by Jake W on 21 Jan, 2021 06:26 PM

    Jake W's Avatar

    Thanks for your reply Brett!

    Yes, when I run cat file.md|myscript.sh I get the expected result.

    In following the instructions for the "Report an Issue" and trying to build a reproduction I can include I may have stumbled on my issue. The test file I had picked was the output of a script I was working on and yesterday I didn't notice that it was quite a large file.

    My preprocessor works fine when I open smaller files.

    I've included my configuration, my script, and a test file which will trigger this issue. If you remove one character from the test file it will process normally. (edit: I couldn't attach my files so I created a Gist instead.)

    I went ahead with these questions in case it's helpful, however knowing it's a file size issue I can easily work around this and look forward to the next update with native emoji support.

    Thanks again for the quick reply, and thanks for Marked, it's such an excellent app.

    Best,
    Jake

    // Configuration (do not edit) Marked 2 1010 (Direct)

    macOS Version: 10.15.7

    additionalMathJaxConfig:
    allowPageBreakInCode: YES
    bookTxtIsLeanpub: NO
    summaryMdIsGitBook: NO
    codeIsPoetry: NO
    codeCanWrap: YES
    collapsibleHeadlines: NO
    convertGithubCheckboxes: YES
    convertYAMLToMMD: NO
    defaultMathJaxConfig: TeX-AMS-MML_HTMLorMML
    defaultPreviewStyle: 3
    defaultProcessor: Discount (GFM)
    enableMiniMap: YES
    excludeBlockQuotesFromCounts: NO
    excludeFootnotesFromCounts: NO
    excludeVerbatimFromCounts: NO
    excludeCaptionsFromCounts: NO
    folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
    githubNewlines: YES
    h1IsPageBreak: NO
    h2IsPageBreak: NO
    hrIsPageBreak: NO
    includeMathJax: NO
    includeKatex: NO
    limitTextWidth: NO
    minimalJavaScript: NO
    outlineModeExtensions:
    permissionGranted: YES
    printHeaderBottomLeft:
    printHeaderBottomRight:
    printHeaderFirstPage: NO
    printFooterFirstPage: NO
    printHeaderTopLeft:
    printHeaderTopRight:
    processHTMLFiles: YES
    removeMetadataForPreview: NO
    removeYAMLHeaders: NO
    scrollToEdit: YES
    shouldDetectCritic: NO
    shouldHighlightMarkupErrors: NO
    shouldLoadCritic: NO
    syntaxHighlight: NO
    syntaxHighlightOnlyLang: NO
    useCustomMarkdownProcessor: NO
    customMarkdownProcessor:
    useCustomPreprocessor: NO
    customPreprocessor: ~/bin/emoji-cli/emojify
    useFirstH1AsPrintTitle: YES

  3. Support Staff 3 Posted by Brett on 21 Jan, 2021 08:49 PM

    Brett's Avatar

    Ok, I can get the same "loading" hang using your script and test files.
    It's weird because the file loads fine without the preprocessor (or with
    any of my usual preprocessors). On the command line your script does
    exactly what it's supposed to do, and without any delay. I'm not sure
    what's choking the process up... I'll look into it further.

    -Brett

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac