handling large md files

Pietro's Avatar


16 Nov, 2023 10:15 AM

// Please enter a detailed description of the issue // Description of the issue: I cannot handle a large markdown file

// Please enter a list of steps required to reproduce the issue // Steps to reproduce:

  1. click an item in the table of contents that is a bit further down

// If applicable please attach a sample document that causes the issue for you. Attached is Python_15.md
// Configuration (do not edit) Marked 2 1054 (Mac App Store)

macOS Version: 14.0

allowPageBreakInCode: YES
bookTxtIsLeanpub: NO
summaryMdIsGitBook: NO
codeIsPoetry: NO
codeCanWrap: YES
collapsibleHeadlines: NO
convertGithubCheckboxes: YES
convertGithubEmoji: YES
convertYAMLToMMD: NO
defaultMathJaxConfig: TeX-AMS-MML_HTMLorMML
defaultPreviewStyle: swiss
defaultProcessor: MultiMarkdown
enableMiniMap: NO
excludeBlockQuotesFromCounts: NO
excludeFootnotesFromCounts: NO
excludeVerbatimFromCounts: NO
excludeCaptionsFromCounts: NO
folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
githubNewlines: YES
h1IsPageBreak: NO
h2IsPageBreak: NO
hrIsPageBreak: NO
includeMathJax: YES
includeKatex: NO
limitTextWidth: NO
mathNumberEquations: NO
mathNumberEquationsSide: 0
mathNumberEquationsAMSOnly: NO
minimalJavaScript: NO
permissionGranted: NO
printHeaderFirstPage: NO
printFooterFirstPage: NO
processHTMLFiles: YES
removeMetadataForPreview: NO
removeYAMLHeaders: NO
scrollToEdit: YES
shouldDetectCritic: YES
shouldHighlightMarkupErrors: NO
shouldLoadCritic: NO
syntaxHighlight: NO
syntaxHighlightOnlyLang: NO
useCustomMarkdownProcessor: NO
useCustomPreprocessor: NO
useFirstH1AsPrintTitle: YES

  1. Support Staff 1 Posted by Brett on 16 Nov, 2023 02:34 PM

    Brett's Avatar

    It has nothing to do with the size of the file, Marked is choking on
    several empty fenced code blocks, which are messing up its built-in code
    rendering. If you remove all instances of



    in the file, everything works as expected. Attaching a fixed version of
    your document.

    Yes, Marked should be able to ignore those, but something about them is
    breaking the regex Marked uses to detect fenced code. I'll have to look
    into that.

    On 16 Nov 2023, at 4:17, Pietro wrote:

  2. Support Staff 2 Posted by Brett on 16 Nov, 2023 02:36 PM

    Brett's Avatar

    By the way, once the file is "fixed" the built-in TOC makes navigating this document a breeze. You can hit ⌘T to bring it up, then hit space and start typing part of a headline and it will filter the list, then you can use arrow keys to highlight and enter to jump to that section.

  3. Support Staff 3 Posted by Brett on 16 Nov, 2023 02:40 PM

    Brett's Avatar

    Also, you might consider breaking this into multipile files, just for ease of editing. Marked offers a ton of ways to do this, can generate the TOC automatically (insert with <!--TOC--> in the document), and can output a compiled single Markdown file if needed. Depending on your final destination, you can use any of these options.

  4. Support Staff 4 Posted by Brett on 16 Nov, 2023 02:45 PM

    Brett's Avatar

    For example, if you delete your whole table of contents and insert this instead:

     <!--TOC max1-->

    You'll get basically the same TOC and you won't have to insert all those <a name> tags throughout the document. It will just work based on headlines.

Reply to this discussion

Internal reply

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

Attaching KB article:


Already uploaded files

  • Python_15.md 229 KB

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


? 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