Is there a way to have a conditional block inside Marked

Amit's Avatar

Amit

23 Aug, 2017 09:20 PM

Could be really powerful and useful to me.

I am thinking something like the #ifdef structure with the C pre-processor of yore.

thanks

Amit

  1. Support Staff 1 Posted by Brett on 23 Aug, 2017 09:27 PM

    Brett's Avatar

    Based on what conditions?

    --
    Brett Terpstra

  2. 2 Posted by Amit Agrawal on 23 Aug, 2017 10:22 PM

    Amit Agrawal's Avatar

    So, I was thinking that I have multiple resumes right now which I am targeting to different people and I would really like an ifdef type mechanism so I can say for example 

    #define EDUCATIONAL_PRODUCT 

    on top and then inside the markdown doc I can say

    #ifdef EDUCATIONAL_PRODUCT
    * Product manager for this awesome product 
    #endif

    and then certain things will be included and not others.  

    Regards

    Amit

    PS: please dont post the above on the forum. 

    A

  3. Support Staff 3 Posted by Brett on 24 Aug, 2017 02:26 PM

    Brett's Avatar

    This is the kind of thing that you'd want to use a custom pre-processor for. A simple script that read in keys at the top and then removed parts conditionally would be pretty easy to set up. Pre-processors run before rendering, and it's designed to allow manipulation of the text before it reaches the Markdown processor.

    http://marked2app.com/help/Custom_Processor.html#preprocessor

  4. 4 Posted by Amit Agrawal on 24 Aug, 2017 11:33 PM

    Amit Agrawal's Avatar

    Thank you. This will work well. 

    Regards

    Amit

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