%%
%% This is file `t-markdown.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% markdown.dtx  (with options: `context')
%% 
%% Copyright (C) 2016 Vít Novotný
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% The Current Maintainer of this work is Vít Novotný.
%% 
%% Send bug reports, requests for additions and questions
%% either to the GitHub issue tracker at
%% 
%%   https://github.com/Witiko/markdown/issues
%% 
%% or to the e-mail address <witiko@mail.muni.cz>.
%% 
%% MODIFICATION ADVICE:
%% 
%% If you want to customize this file, it is best to make a copy of
%% the source file(s) from which it was produced.  Use a different
%% name for your copy(ies) and modify the copy(ies); this will ensure
%% that your modifications do not get overwritten when you install a
%% new release of the standard system.  You should also ensure that
%% your modified source file does not generate any modified file with
%% the same name as a standard file.
%% 
%% You will also need to produce your own, suitably named, .ins file to
%% control the generation of files from your source file; this file
%% should contain your own preambles for the files it generates, not
%% those in the standard .ins files.
%% 
%% The names of the source files used are shown above.
%% 
\writestatus{loading}{ConTeXt User Module / markdown}%
\unprotect
\let\startmarkdown\relax
\let\stopmarkdown\relax
\def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
  \do\#\do\^\do\_\do\%\do\~}%
\ifx\directlua\undefined
  \input markdown
\else
  \directlua{%
    local function unescape(str)
      return (str:gsub("|", string.char(92))) end
    local old_callback = callback.find("process_input_buffer")
    callback.register("process_input_buffer", function() end)
    local new_callback = callback.find("process_input_buffer")
    if new_callback == false then
      tex.print(unescape([[|let|markdownDirectLua|directlua
                           |let|directlua|undefined
                           |input markdown
                           |let|directlua|markdownDirectLua
                           |let|markdownDirectLua|undefined]]))
    else
      callback.register("process_input_buffer", old_callback)
      tex.print(unescape("|input markdown"))
    end}%
\fi
\def\markdownInfo#1{\writestatus{markdown}{#1.}}%
\def\markdownWarning#1{\writestatus{markdown\space warn}{#1.}}%
\begingroup
  \catcode`\|=0%
  \catcode`\\=12%
  |gdef|startmarkdown{%
    |markdownReadAndConvert{\stopmarkdown}%
                           {|stopmarkdown}}%
|endgroup
\def\markdownRendererLineBreakPrototype{\blank}%
\long\def\markdownRendererLinkPrototype#1#2#3{%
  \useURL[#1][#2][][#3]#1\footnote[#1]{\ifx\empty#3\empty\else#3:
  \fi\tt<\hyphenatedurl{#2}>}}%
\long\def\markdownRendererImagePrototype#1#2#3{%
  \placefigure[][fig:#1]{#3}{\externalfigure[#2]}}%
\def\markdownRendererUlBeginPrototype{\startitemize}%
\def\markdownRendererUlBeginTightPrototype{\startitemize[packed]}%
\def\markdownRendererUlItemPrototype{\item}%
\def\markdownRendererUlEndPrototype{\stopitemize}%
\def\markdownRendererUlEndTightPrototype{\stopitemize}%
\def\markdownRendererOlBeginPrototype{\startitemize[n]}%
\def\markdownRendererOlBeginTightPrototype{\startitemize[packed,n]}%
\def\markdownRendererOlItemPrototype{\item}%
\long\def\markdownRendererOlItemWithNumberPrototype#1{\sym{#1.}}%
\def\markdownRendererOlEndPrototype{\stopitemize}%
\def\markdownRendererOlEndTightPrototype{\stopitemize}%
\definedescription
  [markdownConTeXtDlItemPrototype]
  [location=hanging,
   margin=standard,
   headstyle=bold]%
\definestartstop
  [MarkdownConTeXtDlPrototype]
  [before=\blank,
   after=\blank]%
\definestartstop
  [MarkdownConTeXtDlTightPrototype]
  [before=\blank\startpacked,
   after=\stoppacked\blank]%
\def\markdownRendererDlBeginPrototype{%
  \startMarkdownConTeXtDlPrototype}%
\def\markdownRendererDlBeginTightPrototype{%
  \startMarkdownConTeXtDlTightPrototype}%
\long\long\def\markdownRendererDlItemPrototype#1{%
  \markdownConTeXtDlItemPrototype{#1}}%
\def\markdownRendererDlEndPrototype{%
  \stopMarkdownConTeXtDlPrototype}%
\def\markdownRendererDlEndTightPrototype{%
  \stopMarkdownConTeXtDlTightPrototype}%
\long\def\markdownRendererEmphasisPrototype#1{{\em#1}}%
\long\def\markdownRendererStrongEmphasisPrototype#1{{\bf\em#1}}%
\def\markdownRendererBlockQuoteBeginPrototype{\startquotation}%
\def\markdownRendererBlockQuoteEndPrototype{\stopquotation}%
\long\def\markdownRendererInputVerbatimPrototype#1{\typefile{#1}}%
\long\def\markdownRendererHeadingOnePrototype#1{\chapter{#1}}%
\long\def\markdownRendererHeadingTwoPrototype#1{\section{#1}}%
\long\def\markdownRendererHeadingThreePrototype#1{\subsection{#1}}%
\long\def\markdownRendererHeadingFourPrototype#1{\subsubsection{#1}}%
\long\def\markdownRendererHeadingFivePrototype#1{\subsubsubsection{#1}}%
\long\def\markdownRendererHeadingSixPrototype#1{\subsubsubsubsection{#1}}%
\def\markdownRendererHorizontalRulePrototype{%
  \blackrule[height=1pt, width=\hsize]}%
\long\def\markdownRendererFootnotePrototype#1{\footnote{#1}}%
\stopmodule\protect
\endinput
%%
%% End of file `t-markdown.tex'.
