#256

should we add the pygmentize style macros by default to markdown?

    • Created on: Tue, Aug 30 2011 (9 months ago)
    • Reported by: jstrachan
    • Assigned to: -
    • Milestone: -
    • Estimate: None/Small/Medium/Large None
    • Status: New
    • Priority: Normal (3)
    • Component: scalate-core
    • Permission type: Public
    Seems quite a few web apps / websites have this stuff in Boot...


        def filter(m:Matcher):String = {
          val filter_name = m.group(1)
          val body = m.group(2)
          engine.filter(filter_name) match {
            case Some(filter)=>
              filter.filter(RenderContext(), body)
            case None=> "<div class=\"macro error\"><p>filter not found: %s</p><pre>%s</pre></div>".format(filter_name, body)
          }
        }
    
        def pygmentize(m:Matcher):String = Pygmentize.pygmentize(m.group(2), m.group(1))
    
        // add some macros to markdown.
        Markdown.macros :::= List(
          MacroDefinition("""\{filter::(.*?)\}(.*?)\{filter\}""", "s", filter, true),
          MacroDefinition("""\{pygmentize::(.*?)\}(.*?)\{pygmentize\}""", "s", pygmentize, true),
          MacroDefinition("""\{pygmentize\_and\_compare::(.*?)\}(.*?)\{pygmentize\_and\_compare\}""", "s", pygmentize, true)
        )
    
        // add some more recognized pipelines.
        for( ssp <- engine.filter("ssp"); md <- engine.filter("markdown") ) {
          engine.pipelines += "ssp.md"-> List(ssp, md)
          engine.pipelines += "ssp.markdown"-> List(ssp, md)
        }


    Shouldn't this kinda stuff be added by default?
  • Followers
     
    Ico-users jstrachan 
     
    Attachments
    No attachments
    Associations
     
    No associations
    Activity
    Time Expenditure
    Loading