Disabling loading badges from the network

Juan Cruz Viotti's Avatar

Juan Cruz Viotti

18 Jun, 2015 12:24 PM

I usually use Marked 2 to preview my programming module READMEs. Some of them load badges over the network which display the current build status, published version, etc.

I noticed that Marked 2 load each badge from the network every time I make a change, thus adding a small but annoying lag in the workflow.

Is there a way to prevent my markdown file from loading resources from certain hosts? It's unnecessary for me to see the badges when previewing the file locally.

  1. Support Staff 1 Posted by Brett on 18 Jun, 2015 01:26 PM

    Brett's Avatar

    There's no built-in way, but you could add a simple custom preprocessor
    that replaced the badges with a placeholder. Just make a script that
    accepts input on STDIN and returns the result on STDOUT. Ruby, for
    example:

    #!/usr/bin/ruby

    input = STDIN.read.force_encoding('utf8')
    $stdout.puts input.gsub(/<badge regex>/,'[BADGE]')

    You'd just want to make sure that the replacement was something that
    wouldn't cause Marked to think it was a script or image, Markdown or
    otherwise.

    Make it executable and add the path to Marked's preprocessor setting in
    Preferences.

    -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