%%
%% This is file `markdown.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% markdown.dtx  (with options: `tex')
%% 
%% Copyright (C) 2016-2026 Vít Starý Novotný, Andrej Genčur
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% 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
%% 
%% This work has the LPPL maintenance status `maintained'.
%% The Current Maintainer of this work is Vít Starý 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.
%% 
\expandafter\ifx\csname ExplSyntaxOn\endcsname\relax
  \input expl3-generic
\fi
\ExplSyntaxOn
\seq_new:N \g__markdown_lua_options_seq
\prop_new:N \g__markdown_lua_option_types_prop
\prop_new:N \g__markdown_default_lua_options_prop
\seq_new:N \g__markdown_experimental_lua_options_seq
\seq_new:N \g__markdown_option_layers_seq
\tl_const:Nn \c__markdown_option_layer_lua_tl { lua }
\seq_gput_right:NV
  \g__markdown_option_layers_seq
  \c__markdown_option_layer_lua_tl
\cs_new_protected:Nn
  \__markdown_add_lua_option:nnn
  {
    \__markdown_add_option:Vnnn
      \c__markdown_option_layer_lua_tl
      { #1 }
      { #2 }
      { #3 }
  }
\cs_new_protected:Nn
  \__markdown_add_option:nnnn
  {
    \seq_gput_right:cn
      { g__markdown_ #1 _options_seq }
      { #2 }
    \prop_gput:cnn
      { g__markdown_ #1 _option_types_prop }
      { #2 }
      { #3 }
    \prop_gput:cnn
      { g__markdown_default_ #1 _options_prop }
      { #2 }
      { #4 }
    \__markdown_typecheck_option:n
      { #2 }
  }
\cs_generate_variant:Nn
  \__markdown_add_option:nnnn
  { Vnnn }
\cs_new_protected:Nn
  \__markdown_add_experimental_lua_option:n
  {
    \__markdown_add_experimental_option:Vn
      \c__markdown_option_layer_lua_tl
      { #1 }
  }
\cs_new_protected:Nn
  \__markdown_add_experimental_option:nn
  {
    \seq_gput_right:cn
      { g__markdown_ #1 _options_seq }
      { #2 }
    \seq_gput_right:cn
      { g__markdown_experimental_ #1 _options_seq }
      { #2 }
    \prop_gput:cnn
      { g__markdown_ #1 _option_types_prop }
      { #2 }
      { boolean }
  }
\cs_generate_variant:Nn
  \__markdown_add_experimental_option:nn
  { Vn }
\tl_const:Nn \c__markdown_option_value_true_tl  { true  }
\tl_const:Nn \c__markdown_option_value_false_tl { false }
\cs_new_protected:Nn \__markdown_typecheck_option:n
  {
    \__markdown_get_option_type:nN
      { #1 }
      \l_tmpa_tl
    \str_case_e:Vn
      \l_tmpa_tl
      {
        { \c__markdown_option_type_boolean_tl }
          {
            \__markdown_get_option_value:nN
              { #1 }
              \l_tmpa_tl
            \bool_if:nF
              {
                \str_if_eq_p:eV
                  { \l_tmpa_tl }
                  \c__markdown_option_value_true_tl ||
                \str_if_eq_p:eV
                  { \l_tmpa_tl }
                  \c__markdown_option_value_false_tl
              }
              {
                \msg_error:nnne
                  { markdown }
                  { failed-typecheck-for-boolean-option }
                  { #1 }
                  { \l_tmpa_tl }
              }
          }
      }
  }
\msg_new:nnn
  { markdown }
  { failed-typecheck-for-boolean-option }
  {
    Option~#1~has~value~#2,~
    but~a~boolean~(true~or~false)~was~expected.
  }
\cs_generate_variant:Nn
  \str_case_e:nn
  { Vn }
\cs_generate_variant:Nn
  \msg_error:nnnn
  { nnne }
\prg_generate_conditional_variant:Nnn
  \str_if_eq:nn
  { eV }
  { p }
\seq_new:N
  \g__markdown_option_types_seq
\tl_const:Nn
  \c__markdown_option_type_clist_tl
  { clist }
\seq_gput_right:NV
  \g__markdown_option_types_seq
  \c__markdown_option_type_clist_tl
\tl_const:Nn
  \c__markdown_option_type_counter_tl
  { counter }
\seq_gput_right:NV
  \g__markdown_option_types_seq
  \c__markdown_option_type_counter_tl
\tl_const:Nn
  \c__markdown_option_type_boolean_tl
  { boolean }
\seq_gput_right:NV
  \g__markdown_option_types_seq
  \c__markdown_option_type_boolean_tl
\tl_const:Nn
  \c__markdown_option_type_number_tl
  { number }
\seq_gput_right:NV
  \g__markdown_option_types_seq
  \c__markdown_option_type_number_tl
\tl_const:Nn
  \c__markdown_option_type_path_tl
  { path }
\seq_gput_right:NV
  \g__markdown_option_types_seq
  \c__markdown_option_type_path_tl
\tl_const:Nn
  \c__markdown_option_type_slice_tl
  { slice }
\seq_gput_right:NV
  \g__markdown_option_types_seq
  \c__markdown_option_type_slice_tl
\tl_const:Nn
  \c__markdown_option_type_string_tl
  { string }
\seq_gput_right:NV
  \g__markdown_option_types_seq
  \c__markdown_option_type_string_tl
\cs_new_protected:Nn
  \__markdown_get_option_type:nN
  {
    \bool_set_false:N
      \l_tmpa_bool
    \seq_map_inline:Nn
      \g__markdown_option_layers_seq
      {
        \prop_get:cnNT
          { g__markdown_ ##1 _option_types_prop }
          { #1 }
          \l_tmpa_tl
          {
            \bool_set_true:N
              \l_tmpa_bool
            \seq_map_break:
          }
      }
    \bool_if:NF
      \l_tmpa_bool
      {
        \msg_error:nnn
          { markdown }
          { undefined-option }
          { #1 }
      }
    \seq_if_in:NVF
      \g__markdown_option_types_seq
      \l_tmpa_tl
      {
        \msg_error:nnnV
          { markdown }
          { unknown-option-type }
          { #1 }
          \l_tmpa_tl
      }
    \tl_set_eq:NN
      #2
      \l_tmpa_tl
  }
\msg_new:nnn
  { markdown }
  { unknown-option-type }
  {
    Option~#1~has~unknown~type~#2.
  }
\msg_new:nnn
  { markdown }
  { undefined-option }
  {
    Option~#1~is~undefined.
  }
\cs_generate_variant:Nn
  \msg_error:nnnn
  { nnnV }
\cs_new_protected:Nn
  \__markdown_get_default_option_value:nN
  {
    \bool_set_false:N
      \l_tmpa_bool
    \seq_map_inline:Nn
      \g__markdown_option_layers_seq
      {
        \seq_if_in:cnT
          { g__markdown_experimental_ ##1 _options_seq }
          { #1 }
          {
            \__markdown_get_option_value:nN
              { experimental }
              #2
            \bool_set_true:N
              \l_tmpa_bool
            \seq_map_break:
          }
        \prop_get:cnNT
          { g__markdown_default_ ##1 _options_prop }
          { #1 }
          #2
          {
            \bool_set_true:N
              \l_tmpa_bool
            \seq_map_break:
          }
      }
    \bool_if:NF
      \l_tmpa_bool
      {
        \msg_error:nnn
          { markdown }
          { undefined-option }
          { #1 }
      }
  }
\cs_new_protected:Nn
  \__markdown_get_option_value:nN
  {
    \__markdown_option_tl_to_csname:nN
      { #1 }
      \l_tmpa_tl
    \cs_if_free:cTF
      { \l_tmpa_tl }
      {
        \__markdown_get_default_option_value:nN
          { #1 }
          #2
      }
      {
        \__markdown_get_option_type:nN
          { #1 }
          \l_tmpa_tl
        \str_if_eq:NNTF
          \c__markdown_option_type_counter_tl
          \l_tmpa_tl
          {
            \__markdown_option_tl_to_csname:nN
              { #1 }
              \l_tmpa_tl
            \tl_set:Nx
              #2
              { \the \cs:w \l_tmpa_tl \cs_end: }
          }
          {
            \__markdown_option_tl_to_csname:nN
              { #1 }
              \l_tmpa_tl
            \tl_set:Nv
              #2
              { \l_tmpa_tl }
          }
      }
  }
\cs_new_protected:Nn \__markdown_option_tl_to_csname:nN
  {
    \tl_set:Nn
      \l_tmpa_tl
      { \str_uppercase:n { #1 } }
    \tl_set:Nx
      #2
      {
        markdownOption
        \tl_head:f { \l_tmpa_tl }
        \tl_tail:n { #1 }
      }
  }
\regex_const:Nn
  \c__markdown_option_regex
  { ^markdownOption }
\prg_new_protected_conditional:Nnn
  \__markdown_csname_to_option_str:nN
  { T }
  {
    \tl_if_regex_match:nNTF
      { #1 }
      \c__markdown_option_regex
      {
        \tl_set:Nn
          \l_tmpa_tl
          { #1 }
        \tl_regex_replace_once:NNn
          \l_tmpa_tl
          \c__markdown_option_regex
          { }
        \tl_set:Nn
          \l_tmpb_tl
          {
            \str_lowercase:f
              { \l_tmpa_tl }
          }
        \str_set:Nx
          #2
          {
            \tl_head:f { \l_tmpb_tl }
            \tl_tail:V \l_tmpa_tl
          }
        \prg_return_true:
      }
      { \prg_return_false: }
  }
\cs_new_protected:Nn \__markdown_with_various_cases:nn
  {
    \seq_clear:N
      \l_tmpa_seq
    \seq_map_inline:Nn
      \g__markdown_cases_seq
      {
        \tl_set:Nn
          \l_tmpa_tl
          { #1 }
        \use:c { ##1 }
          \l_tmpa_tl
        \seq_put_right:NV
          \l_tmpa_seq
          \l_tmpa_tl
      }
    \seq_map_inline:Nn
      \l_tmpa_seq
      { #2 }
  }
\seq_new:N \g__markdown_cases_seq
\cs_new_protected:Nn \__markdown_camel_case:N
  {
    \regex_replace_all:nnN
      { _ ([a-z]) }
      { \c { str_uppercase:n } \cB\{ \1 \cE\} }
      #1
    \tl_set:Nx
      #1
      { #1 }
  }
\seq_gput_right:Nn \g__markdown_cases_seq { __markdown_camel_case:N }
\cs_new_protected:Nn \__markdown_snake_case:N
  {
    \regex_replace_all:nnN
      { ([a-z])([A-Z]) }
      { \1 _ \c { str_lowercase:n } \cB\{ \2 \cE\} }
      #1
    \tl_set:Nx
      #1
      { #1 }
  }
\seq_gput_right:Nn \g__markdown_cases_seq { __markdown_snake_case:N }
\__markdown_add_lua_option:nnn
  { eagerCache }
  { boolean }
  { true }
\__markdown_add_lua_option:nnn
  { experimental }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { singletonCache }
  { boolean }
  { true }
\__markdown_add_lua_option:nnn
  { unicodeNormalization }
  { boolean }
  { true }
\__markdown_add_lua_option:nnn
  { unicodeNormalizationForm }
  { string }
  { nfc }
\str_new:N
  \g__markdown_unquoted_jobname_str
\str_gset:NV
  \g__markdown_unquoted_jobname_str
  \c_sys_jobname_str
\bool_new:N
  \g__markdown_jobname_quoted_bool
\regex_replace_all:nnNTF
  { \A ("|') ( .* ) ("|') \Z }
  { \2 }
  \g__markdown_unquoted_jobname_str
  {
    \bool_gset_true:N
      \g__markdown_jobname_quoted_bool
  }
  {
    \bool_gset_false:N
      \g__markdown_jobname_quoted_bool
  }
\__markdown_add_lua_option:nnn
  { cacheDir }
  { path }
  {
    \markdownOptionOutputDir
    / _markdown_
    \str_use:N
      \g__markdown_unquoted_jobname_str
  }
\__markdown_add_lua_option:nnn
  { contentBlocksLanguageMap }
  { path }
  { markdown-languages.json }
\__markdown_add_lua_option:nnn
  { debugExtensionsFileName }
  { path }
  {
    \markdownOptionOutputDir
    /
    \str_use:N
      \g__markdown_unquoted_jobname_str
    .debug-extensions.json
  }
\__markdown_add_lua_option:nnn
  { frozenCacheFileName }
  { path }
  { \markdownOptionCacheDir / frozenCache.tex }
\cs_generate_variant:Nn
  \__markdown_add_lua_option:nnn
  { nnV }
\__markdown_add_lua_option:nnV
  { acronyms }
  { clist }
  \c_empty_clist
\__markdown_add_lua_option:nnn
  { autoIdentifiers }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { blankBeforeBlockquote }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { blankBeforeCodeFence }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { blankBeforeDivFence }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { blankBeforeHeading }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { blankBeforeHtmlBlock }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { blankBeforeList }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { bracketedSpans }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { breakableBlockquotes }
  { boolean }
  { true }
\__markdown_add_lua_option:nnn
  { citationNbsps }
  { boolean }
  { true }
\__markdown_add_lua_option:nnn
  { citations }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { codeSpans }
  { boolean }
  { true }
\__markdown_add_lua_option:nnn
  { contentBlocks }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { contentLevel }
  { string }
  { block }
\__markdown_add_lua_option:nnn
  { debugExtensions }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { definitionLists }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { ensureJekyllData }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { expectJekyllData }
  { boolean }
  { false }
\__markdown_add_lua_option:nnV
  { extensions }
  { clist }
  \c_empty_clist
\__markdown_add_lua_option:nnn
  { fancyLists }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { fencedCode }
  { boolean }
  { true }
\__markdown_add_lua_option:nnn
  { fencedCodeAttributes }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { fencedDivs }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { finalizeCache }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { frozenCacheCounter }
  { counter }
  { 0 }
\__markdown_add_lua_option:nnn
  { gfmAutoIdentifiers }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { hashEnumerators }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { headerAttributes }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { html }
  { boolean }
  { true }
\__markdown_add_lua_option:nnn
  { htmlOutput }
  { string }
  { basic }
\__markdown_add_experimental_lua_option:n
  { htmlOverLinks }
\__markdown_add_lua_option:nnn
  { hybrid }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { inlineCodeAttributes }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { inlineNotes }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { jekyllData }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { linkAttributes }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { lineBlocks }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { mark }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { notes }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { pipeTables }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { preserveTabs }
  { boolean }
  { true }
\__markdown_add_lua_option:nnn
  { rawAttribute }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { relativeReferences }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { shiftHeadings }
  { number }
  { 0 }
\__markdown_add_lua_option:nnn
  { slice }
  { slice }
  { ^~$ }
\__markdown_add_lua_option:nnn
  { smartEllipses }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { startNumber }
  { boolean }
  { true }
\__markdown_add_lua_option:nnn
  { strikeThrough }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { stripIndent }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { subscripts }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { superscripts }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { tableAttributes }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { tableCaptions }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { taskLists }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { texComments }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { texMathDollars }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { texMathDoubleBackslash }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { texMathSingleBackslash }
  { boolean }
  { false }
\__markdown_add_lua_option:nnn
  { tightLists }
  { boolean }
  { true }
\__markdown_add_lua_option:nnn
  { underscores }
  { boolean }
  { true }
\ExplSyntaxOff
\def\markdownLastModified{2026-06-11}%
\def\markdownVersion{3.15.1-0-g51841b67}%
\let\markdownBegin\relax
\let\markdownEnd\relax
\let\yamlBegin\relax
\def\yamlEnd{\markdownEnd\endgroup}
\let\markinline\relax
\let\markdownInput\relax
\def\yamlInput#1{%
  \begingroup
  \yamlSetup{jekyllData, expectJekyllData, ensureJekyllData}%
  \markdownInput{#1}%
  \endgroup
}%
\let\markdownEscape\relax
\ExplSyntaxOn
\tl_const:Nn \c__markdown_option_layer_plain_tex_tl { plain_tex }
\cs_generate_variant:Nn
  \tl_const:Nn
  { NV }
\tl_if_exist:NF
  \c__markdown_top_layer_tl
  {
    \tl_const:NV
      \c__markdown_top_layer_tl
      \c__markdown_option_layer_plain_tex_tl
  }
\seq_new:N \g__markdown_plain_tex_options_seq
\prop_new:N \g__markdown_plain_tex_option_types_prop
\prop_new:N \g__markdown_default_plain_tex_options_prop
\seq_new:N \g__markdown_experimental_plain_tex_options_seq
\seq_gput_right:NV
  \g__markdown_option_layers_seq
  \c__markdown_option_layer_plain_tex_tl
\cs_new_protected:Nn
  \__markdown_add_plain_tex_option:nnn
  {
    \__markdown_add_option:Vnnn
      \c__markdown_option_layer_plain_tex_tl
      { #1 }
      { #2 }
      { #3 }
  }
\cs_new_protected:Nn
  \__markdown_setup:n
  {
    \keys_set:nn
      { markdown/options }
      { #1 }
  }
\cs_gset_eq:NN
  \markdownSetup
  \__markdown_setup:n
\cs_gset_eq:NN
  \yamlSetup
  \markdownSetup
\prg_new_protected_conditional:Nnn
  \__markdown_if_option:n
  { TF, T, F }
  {
    \__markdown_get_option_type:nN
      { #1 }
      \l_tmpa_tl
    \str_if_eq:NNF
      \l_tmpa_tl
      \c__markdown_option_type_boolean_tl
      {
        \msg_error:nnxx
          { markdown }
          { expected-boolean-option }
          { #1 }
          { \l_tmpa_tl }
      }
    \__markdown_get_option_value:nN
      { #1 }
      \l_tmpa_tl
    \str_if_eq:NNTF
      \l_tmpa_tl
      \c__markdown_option_value_true_tl
      { \prg_return_true: }
      { \prg_return_false: }
  }
\msg_new:nnn
  { markdown }
  { expected-boolean-option }
  {
    Option~#1~has~type~#2,~
    but~a~boolean~was~expected.
  }
\let
  \markdownIfOption
  \__markdown_if_option:nTF
\__markdown_add_plain_tex_option:nnn
  { frozenCache }
  { boolean }
  { false }
\tl_set:Nn
  \l_tmpa_tl
  {
    \str_use:N
      \g__markdown_unquoted_jobname_str
    .markdown.in
  }
\bool_if:NT
  \g__markdown_jobname_quoted_bool
  {
    \tl_put_left:Nn
      \l_tmpa_tl
      { " }
    \tl_put_right:Nn
      \l_tmpa_tl
      { " }
  }
\cs_generate_variant:Nn
  \__markdown_add_plain_tex_option:nnn
  { nnV }
\__markdown_add_plain_tex_option:nnV
  { inputTempFileName }
  { path }
  \l_tmpa_tl
\__markdown_add_plain_tex_option:nnn
  { outputDir }
  { path }
  { . }
\__markdown_add_plain_tex_option:nnn
  { plain }
  { boolean }
  { false }
\__markdown_add_plain_tex_option:nnn
  { noDefaults }
  { boolean }
  { false }
\seq_gput_right:Nn
  \g__markdown_plain_tex_options_seq
  { stripPercentSigns }
\prop_gput:Nnn
  \g__markdown_plain_tex_option_types_prop
  { stripPercentSigns }
  { boolean }
\prop_gput:Nnx
  \g__markdown_default_plain_tex_options_prop
  { stripPercentSigns }
  { false }
\cs_new_protected:Nn
  \__markdown_define_option_commands_and_keyvals:
  {
    \seq_map_inline:Nn
      \g__markdown_option_layers_seq
      {
        \seq_map_inline:cn
          { g__markdown_ ##1 _options_seq }
          {
              \__markdown_define_option_command:n
                { ####1 }
              \__markdown_with_various_cases:nn
                { ####1 }
                {
                  \__markdown_define_option_keyval:nnn
                    { ##1 }
                    { ####1 }
                    { ########1 }
                }
          }
      }
  }
\cs_new_protected:Nn
  \__markdown_define_option_command:n
  {
    \bool_set_false:N
      \l_tmpa_bool
    \seq_map_inline:Nn
      \g__markdown_option_layers_seq
      {
        \seq_if_in:cnT
          { g__markdown_experimental_ ##1 _options_seq }
          { #1 }
          {
            \bool_set_true:N
              \l_tmpa_bool
            \seq_map_break:
          }
      }
    \bool_if:NTF
      \l_tmpa_bool
      {
        \__markdown_option_tl_to_csname:nN
          { #1 }
          \l_tmpa_tl
        \cs_if_exist:cF
          { \l_tmpa_tl }
          {
            \cs_gset:cpn
              { \l_tmpa_tl }
              { \markdownOptionExperimental }
          }
      }
      {
        \str_if_eq:nnTF
          { #1 }
          { outputDir }
          { \__markdown_define_option_command_output_dir: }
          {
            \__markdown_option_tl_to_csname:nN
              { #1 }
              \l_tmpa_tl
            \cs_if_exist:cF
              { \l_tmpa_tl }
              {
                \__markdown_get_default_option_value:nN
                  { #1 }
                  \l_tmpa_tl
                \__markdown_set_option_value:nV
                  { #1 }
                  \l_tmpa_tl
              }
          }
      }
  }
\ExplSyntaxOff
\input lt3luabridge.tex
\ExplSyntaxOn
\cs_new:Nn
  \__markdown_define_option_command_output_dir:
  {
    \cs_if_free:NT
      \markdownOptionOutputDir
      {
        \bool_if:nTF
          {
            \cs_if_exist_p:N
              \luabridge_tl_set:Nn &&
            (
              \int_compare_p:nNn
                { \g_luabridge_method_int }
                =
                { \c_luabridge_method_directlua_int } ||
              \sys_if_shell_unrestricted_p:
            )
          }
          {
            \group_begin:
            \cctab_select:N
              \c_str_cctab
            \luabridge_tl_set:Nn
              \l_tmpa_tl
              {
                print(
                  (status.output_directory)
                  or~os.getenv("TEXMF_OUTPUT_DIRECTORY")
                  or~"."
                )
              }
            \tl_gset:NV
              \markdownOptionOutputDir
              \l_tmpa_tl
            \group_end:
          }
          {
            \tl_gset:Nn
              \markdownOptionOutputDir
              { . }
          }
      }
  }
\cs_new_protected:Nn
  \__markdown_set_option_value:nn
  {
    \__markdown_define_option:n
      { #1 }
    \__markdown_get_option_type:nN
      { #1 }
      \l_tmpa_tl
    \str_if_eq:NNTF
      \c__markdown_option_type_counter_tl
      \l_tmpa_tl
      {
        \__markdown_option_tl_to_csname:nN
          { #1 }
          \l_tmpa_tl
        \int_gset:cn
          { \l_tmpa_tl }
          { #2 }
      }
      {
        \__markdown_option_tl_to_csname:nN
          { #1 }
          \l_tmpa_tl
        \cs_set:cpn
          { \l_tmpa_tl }
          { #2 }
      }
  }
\cs_new_protected:Nn
  \__markdown_prepend_option_value:nn
  {
    \__markdown_get_option_value:nN
      { #1 }
      \l_tmpa_clist
    \clist_put_left:Nn
      \l_tmpa_clist
      { #2 }
    \__markdown_set_option_value:nV
      { #1 }
      \l_tmpa_clist
  }
\cs_new_protected:Nn
  \__markdown_append_option_value:nn
  {
    \__markdown_get_option_value:nN
      { #1 }
      \l_tmpa_clist
    \clist_put_right:Nn
      \l_tmpa_clist
      { #2 }
    \__markdown_set_option_value:nV
      { #1 }
      \l_tmpa_clist
  }
\cs_generate_variant:Nn
  \__markdown_set_option_value:nn
  { nV }
\cs_new_protected:Nn
  \__markdown_define_option:n
  {
    \__markdown_option_tl_to_csname:nN
      { #1 }
      \l_tmpa_tl
    \cs_if_free:cT
      { \l_tmpa_tl }
      {
        \__markdown_get_option_type:nN
          { #1 }
          \l_tmpb_tl
        \str_if_eq:NNT
          \c__markdown_option_type_counter_tl
          \l_tmpb_tl
          {
            \__markdown_option_tl_to_csname:nN
              { #1 }
              \l_tmpa_tl
            \int_new:c
              { \l_tmpa_tl }
          }
      }
  }
\cs_new_protected:Nn
  \__markdown_define_option_keyval:nnn
  {
    \prop_get:cnN
      { g__markdown_ #1 _option_types_prop }
      { #2 }
      \l_tmpa_tl
    \str_if_eq:VVTF
      \l_tmpa_tl
      \c__markdown_option_type_boolean_tl
      {
        \keys_define:nn
          { markdown/options }
          {
            #3 .code:n = {
              \tl_set:Nx
                \l_tmpa_tl
                {
                  \str_case:nnF
                    { ##1 }
                    {
                      { yes } { true }
                      { no } { false }
                    }
                    { ##1 }
                }
              \__markdown_set_option_value:nV
                { #2 }
                \l_tmpa_tl
            },
            #3 .value_required:n = { false },
            #3 .default:n = { true },
          }
      }
      {
        \keys_define:nn
          { markdown/options }
          {
            #3 .value_required:n = { true },
            #3 .code:n = {
              \__markdown_set_option_value:nn
                { #2 }
                { ##1 }
            },
          }
      }
    \str_if_eq:VVT
      \l_tmpa_tl
      \c__markdown_option_type_clist_tl
      {
        \tl_set:Nn
          \l_tmpa_tl
          { #3 }
        \tl_reverse:N
          \l_tmpa_tl
        \str_if_eq:enF
          {
            \tl_head:V
              \l_tmpa_tl
          }
          { s }
          {
            \msg_error:nnn
              { markdown }
              { malformed-name-for-clist-option }
              { #3 }
          }
        \tl_set:Nx
          \l_tmpa_tl
          {
            \tl_tail:V
              \l_tmpa_tl
          }
        \tl_reverse:N
          \l_tmpa_tl
        \tl_set_eq:NN
          \l_tmpb_tl
          \l_tmpa_tl
        \tl_put_right:Nn
          \l_tmpa_tl
          { .value_required:n = { true } }
        \tl_put_right:Nn
          \l_tmpb_tl
          {
            .code:n = {
              \__markdown_append_option_value:nn
                { #2 }
                { ##1 }
            }
          }
        \keys_define:nV
          { markdown/options }
          \l_tmpa_tl
        \keys_define:nV
          { markdown/options }
          \l_tmpb_tl
        \keys_define:nn
          { markdown/options }
          {
            #3~+ .value_required:n = { true },
            #3~+ .code:n = {
              \__markdown_append_option_value:nn
                { #2 }
                { ##1 }
            },
            #3 + .value_required:n = { true },
            #3 + .code:n = {
              \__markdown_append_option_value:nn
                { #2 }
                { ##1 }
            },
            #3~$ .value_required:n = { true },
            #3~$ .code:n = {
              \__markdown_append_option_value:nn
                { #2 }
                { ##1 }
            },
            #3 $ .value_required:n = { true },
            #3 $ .code:n = {
              \__markdown_append_option_value:nn
                { #2 }
                { ##1 }
            },
            #3~^ .value_required:n = { true },
            #3~^ .code:n = {
              \__markdown_prepend_option_value:nn
                { #2 }
                { ##1 }
            },
            #3 ^ .value_required:n = { true },
            #3 ^ .code:n = {
              \__markdown_prepend_option_value:nn
                { #2 }
                { ##1 }
            },
          }
      }
  }
\cs_generate_variant:Nn
  \clist_set:Nn
  { NV }
\cs_generate_variant:Nn
  \keys_define:nn
  { nV }
\prg_generate_conditional_variant:Nnn
  \str_if_eq:nn
  { en }
  { p, F }
\msg_new:nnn
  { markdown }
  { malformed-name-for-clist-option }
  {
    Clist~option~name~#1~does~not~end~with~-s.
  }
\str_if_eq:VVT
  \c__markdown_top_layer_tl
  \c__markdown_option_layer_plain_tex_tl
  {
    \__markdown_define_option_commands_and_keyvals:
  }
\keys_define:nn
  { markdown/options }
  {
    theme .value_required:n = { true },
    theme .code:n = {
      \__markdown_set_theme:n
        { #1 }
    },
    import .value_required:n = { true },
    import .code:n = {
      \tl_set:Nn
        \l_tmpa_tl
        { #1 }
      \tl_replace_all:NnV
        \l_tmpa_tl
        { / }
        \c_backslash_str
      \keys_set:nV
        { markdown/options/import }
        \l_tmpa_tl
    },
  }
\seq_new:N
  \g__markdown_theme_names_seq
\seq_new:N
  \g__markdown_theme_versions_seq
\tl_new:N
  \g__markdown_current_theme_tl
\tl_gset:Nn
  \g__markdown_current_theme_tl
  { }
\seq_gput_right:NV
  \g__markdown_theme_names_seq
  \g__markdown_current_theme_tl
\cs_new:Npn
  \markdownThemeVersion
  { }
\seq_gput_right:NV
  \g__markdown_theme_versions_seq
  \g__markdown_current_theme_tl
\cs_new_protected:Nn
  \__markdown_set_theme:n
  {
    \str_if_in:nnF
      { #1 }
      { / }
      {
        \msg_error:nnn
          { markdown }
          { unqualified-theme-name }
          { #1 }
      }
    \str_if_in:nnT
      { #1 }
      { _ }
      {
        \msg_error:nnn
          { markdown }
          { underscores-in-theme-name }
          { #1 }
      }
    \str_if_in:nnTF
      { #1 }
      { @ }
      {
        \regex_extract_once:nnN
          { (.*) @ (.*) }
          { #1 }
          \l_tmpa_seq
        \seq_gpop_left:NN
          \l_tmpa_seq
          \l_tmpa_tl
        \seq_gpop_left:NN
          \l_tmpa_seq
          \l_tmpa_tl
        \tl_gset:NV
          \g__markdown_current_theme_tl
          \l_tmpa_tl
        \seq_gpop_left:NN
          \l_tmpa_seq
          \l_tmpa_tl
        \cs_gset:Npe
          \markdownThemeVersion
          {
            \tl_use:N
              \l_tmpa_tl
          }
      }
      {
        \tl_gset:Nn
          \g__markdown_current_theme_tl
          { #1 }
        \cs_gset:Npn
          \markdownThemeVersion
          { latest }
      }
    \str_if_eq:enT
      {
        \tl_head:V
          \g__markdown_current_theme_tl
      }
      { / }
      {
        \tl_gset:Ne
          \g__markdown_current_theme_tl
          {
            \tl_tail:V
              \g__markdown_current_theme_tl
          }
      }
    \str_set:NV
      \l_tmpa_str
      \g__markdown_current_theme_tl
    \str_replace_all:Nnn
      \l_tmpa_str
      { / }
      { _ }
    \tl_set:NV
      \l_tmpa_tl
      \g__markdown_current_theme_tl
    \tl_put_right:Nn
      \g__markdown_current_theme_tl
      { / }
    \seq_gput_right:NV
      \g__markdown_theme_names_seq
      \g__markdown_current_theme_tl
    \seq_gput_right:NV
      \g__markdown_theme_versions_seq
      \markdownThemeVersion
    \__markdown_load_theme:VeV
      \l_tmpa_tl
      { \markdownThemeVersion }
      \l_tmpa_str
    \seq_gpop_right:NN
      \g__markdown_theme_names_seq
      \l_tmpa_tl
    \seq_get_right:NN
      \g__markdown_theme_names_seq
      \l_tmpa_tl
    \tl_gset:NV
      \g__markdown_current_theme_tl
      \l_tmpa_tl
    \seq_gpop_right:NN
      \g__markdown_theme_versions_seq
      \l_tmpa_tl
    \seq_get_right:NN
      \g__markdown_theme_versions_seq
      \l_tmpa_tl
    \cs_gset:Npe
      \markdownThemeVersion
      {
        \tl_use:N
          \l_tmpa_tl
      }
  }
\msg_new:nnnn
  { markdown }
  { unqualified-theme-name }
  { Won't~load~theme~with~unqualified~name~#1 }
  { Theme~names~must~contain~at~least~one~forward~slash }
\msg_new:nnnn
  { markdown }
  { underscores-in-theme-name }
  { Won't~load~theme~with~an~underscore~in~its~name~#1 }
  { Theme~names~must~not~contain~underscores~in~their~names }
\cs_generate_variant:Nn
  \tl_replace_all:Nnn
  { NnV }
\cs_generate_variant:Nn
  \cs_gset:Npn
  { Npe }
\prg_generate_conditional_variant:Nnn
  \str_if_eq:nn
  { en }
  { T }
\prop_new:N
  \g__markdown_plain_tex_built_in_themes_prop
\prop_new:N
  \g__markdown_snippets_prop
\cs_new_protected:Nn
  \__markdown_setup_snippet:nn
  {
    \tl_if_empty:nT
      { #1 }
      {
        \msg_error:nnn
          { markdown }
          { empty-snippet-name }
          { #1 }
      }
    \__markdown_resolve_snippet_name:nN
      { #1 }
      \l_tmpa_tl
    \__markdown_if_snippet_exists:nT
      { #1 }
      {
        \msg_warning:nnV
          { markdown }
          { redefined-snippet }
          \l_tmpa_tl
      }
    \keys_precompile:nnN
      { markdown/options }
      { #2 }
      \l_tmpb_tl
    \prop_gput:NVV
      \g__markdown_snippets_prop
      \l_tmpa_tl
      \l_tmpb_tl
  }
\cs_gset_eq:NN
  \markdownSetupSnippet
  \__markdown_setup_snippet:nn
\msg_new:nnnn
  { markdown }
  { empty-snippet-name }
  { Empty~snippet~name~#1 }
  { Pick~a~non-empty~name~for~your~snippet }
\msg_new:nnn
  { markdown }
  { redefined-snippet }
  { Redefined~snippet~#1 }
\tl_new:N
  \l__markdown_current_snippet_tl
\prg_new_protected_conditional:Nnn
  \__markdown_if_snippet_exists:n
  { TF, T }
  {
    \__markdown_resolve_snippet_name:nN
      { #1 }
      \l__markdown_current_snippet_tl
    \prop_if_in:NVTF
      \g__markdown_snippets_prop
      \l__markdown_current_snippet_tl
      { \prg_return_true: }
      { \prg_return_false: }
  }
\cs_gset_eq:NN
  \markdownIfSnippetExists
  \__markdown_if_snippet_exists:nTF
\cs_new_protected:Nn
  \__markdown_resolve_snippet_name:nN
  {
    \str_if_eq:enTF
      {
        \tl_head:n
          { #1 }
      }
      { / }
      {
        \tl_set:Ne
          #2
          {
            \tl_tail:n
              { #1 }
          }
      }
      {
        \tl_set:NV
          #2
          \g__markdown_current_theme_tl
        \tl_put_right:Nn
          #2
          { #1 }
      }
  }
\prg_generate_conditional_variant:Nnn
  \str_if_eq:nn
  { en }
  { TF }
\keys_define:nn
  { markdown/options }
  {
    snippet .value_required:n = { true },
    snippet .code:n = {
      \__markdown_resolve_snippet_name:nN
        { #1 }
        \l_tmpa_tl
      \__markdown_if_snippet_exists:nTF
        { #1 }
        {
          \prop_get:NVN
            \g__markdown_snippets_prop
            \l_tmpa_tl
            \l_tmpb_tl
          \tl_use:N
            \l_tmpb_tl
        }
        {
          \msg_error:nnV
            { markdown }
            { undefined-snippet }
            \l_tmpa_tl
        }
    },
  }
\msg_new:nnn
  { markdown }
  { undefined-snippet }
  { Can't~invoke~undefined~snippet~#1 }
\tl_new:N
  \l__markdown_import_current_theme_tl
\keys_define:nn
  { markdown/options/import }
  {
    unknown .value_required:n = { false },
    unknown .default:n = {},
    unknown .code:n = {
      \tl_set_eq:NN
        \l__markdown_import_current_theme_tl
        \l_keys_key_str
      \tl_replace_all:NVn
        \l__markdown_import_current_theme_tl
        \c_backslash_str
        { / }
      \clist_map_inline:nn
        { #1 }
        {
          \regex_extract_once:nnNTF
            { ^(.*?)\s+as\s+(.*?)$ }
            { ##1 }
            \l_tmpa_seq
            {
              \seq_pop:NN
                \l_tmpa_seq
                \l_tmpa_tl
              \seq_pop:NN
                \l_tmpa_seq
                \l_tmpa_tl
              \seq_pop:NN
                \l_tmpa_seq
                \l_tmpb_tl
            }
            {
              \tl_set:Nn
                \l_tmpa_tl
                { ##1 }
              \tl_set:Nn
                \l_tmpb_tl
                { ##1 }
            }
          \tl_put_left:Nn
            \l_tmpa_tl
            { / }
          \tl_put_left:NV
            \l_tmpa_tl
            \l__markdown_import_current_theme_tl
          \__markdown_setup_snippet:Vx
            \l_tmpb_tl
            { snippet = { \l_tmpa_tl } }
        }
      \__markdown_set_theme:V
        \l__markdown_import_current_theme_tl
    },
  }
\cs_generate_variant:Nn
  \tl_replace_all:Nnn
  { NVn }
\cs_generate_variant:Nn
  \__markdown_set_theme:n
  { V }
\cs_generate_variant:Nn
  \__markdown_setup_snippet:nn
  { Vx }
\seq_new:N \g__markdown_renderers_seq
\prop_new:N \g__markdown_renderer_arities_prop
\cs_gset_protected:Npn
  \markdownRendererAcronym
  {
    \markdownRendererAcronymPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { acronym }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { acronym }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererAttributeIdentifier
  {
    \markdownRendererAttributeIdentifierPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { attributeIdentifier }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { attributeIdentifier }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererAttributeClassName
  {
    \markdownRendererAttributeClassNamePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { attributeClassName }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { attributeClassName }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererAttributeKeyValue
  {
    \markdownRendererAttributeKeyValuePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { attributeKeyValue }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { attributeKeyValue }
  { 2 }
\cs_gset_protected:Npn
  \markdownRendererInlineHtmlComment
  {
    \markdownRendererInlineHtmlCommentPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inlineHtmlComment }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inlineHtmlComment }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInlineHtmlTag
  {
    \markdownRendererInlineHtmlTagPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inlineHtmlTag }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inlineHtmlTag }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInputBlockHtmlElement
  {
    \markdownRendererInputBlockHtmlElementPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inputBlockHtmlElement }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inputBlockHtmlElement }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererBlockQuoteBegin
  {
    \markdownRendererBlockQuoteBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { blockQuoteBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { blockQuoteBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererBlockQuoteEnd
  {
    \markdownRendererBlockQuoteEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { blockQuoteEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { blockQuoteEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererBracketedSpan
  {
    \markdownRendererBracketedSpanPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { bracketedSpan }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { bracketedSpan }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererBracketedSpanAttributeContextBegin
  {
    \markdownRendererBracketedSpanAttributeContextBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { bracketedSpanAttributeContextBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { bracketedSpanAttributeContextBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererBracketedSpanAttributeContextEnd
  {
    \markdownRendererBracketedSpanAttributeContextEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { bracketedSpanAttributeContextEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { bracketedSpanAttributeContextEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererUlBegin
  {
    \markdownRendererUlBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { ulBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { ulBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererUlBeginTight
  {
    \markdownRendererUlBeginTightPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { ulBeginTight }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { ulBeginTight }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererUlItem
  {
    \markdownRendererUlItemPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { ulItem }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { ulItem }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererUlItemEnd
  {
    \markdownRendererUlItemEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { ulItemEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { ulItemEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererUlEnd
  {
    \markdownRendererUlEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { ulEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { ulEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererUlEndTight
  {
    \markdownRendererUlEndTightPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { ulEndTight }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { ulEndTight }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererCite
  {
    \markdownRendererCitePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { cite }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { cite }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererTextCite
  {
    \markdownRendererTextCitePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { textCite }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { textCite }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInputVerbatim
  {
    \markdownRendererInputVerbatimPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inputVerbatim }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inputVerbatim }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInputFencedCode
  {
    \markdownRendererInputFencedCodePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inputFencedCode }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inputFencedCode }
  { 3 }
\cs_gset_protected:Npn
  \markdownRendererCodeSpan
  {
    \markdownRendererCodeSpanPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { codeSpan }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { codeSpan }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererCodeSpanAttributeContextBegin
  {
    \markdownRendererCodeSpanAttributeContextBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { codeSpanAttributeContextBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { codeSpanAttributeContextBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererCodeSpanAttributeContextEnd
  {
    \markdownRendererCodeSpanAttributeContextEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { codeSpanAttributeContextEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { codeSpanAttributeContextEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererInputBlockHtmlCdataElement
  {
    \markdownRendererInputBlockHtmlCdataElementPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inputBlockHtmlCdataElement }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inputBlockHtmlCdataElement }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererBlockHtmlComment
  {
    \markdownRendererBlockHtmlCommentPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { blockHtmlComment }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { blockHtmlComment }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInputBlockHtmlProcessingInstruction
  {
    \markdownRendererInputBlockHtmlProcessingInstructionPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inputBlockHtmlProcessingInstruction }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inputBlockHtmlProcessingInstruction }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInputBlockHtmlDeclaration
  {
    \markdownRendererInputBlockHtmlDeclarationPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inputBlockHtmlDeclaration }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inputBlockHtmlDeclaration }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInputBlockHtmlCdataSection
  {
    \markdownRendererInputBlockHtmlCdataSectionPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inputBlockHtmlCdataSection }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inputBlockHtmlCdataSection }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInputBlockHtmlPcdataElement
  {
    \markdownRendererInputBlockHtmlPcdataElementPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inputBlockHtmlPcdataElement }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inputBlockHtmlPcdataElement }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererBlockHtmlStandaloneTag
  {
    \markdownRendererBlockHtmlStandaloneTagPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { blockHtmlStandaloneTag }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { blockHtmlStandaloneTag }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInlineHtmlProcessingInstruction
  {
    \markdownRendererInlineHtmlProcessingInstructionPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inlineHtmlProcessingInstruction }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inlineHtmlProcessingInstruction }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInlineHtmlDeclaration
  {
    \markdownRendererInlineHtmlDeclarationPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inlineHtmlDeclaration }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inlineHtmlDeclaration }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInlineHtmlCdataSection
  {
    \markdownRendererInlineHtmlCdataSectionPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inlineHtmlCdataSection }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inlineHtmlCdataSection }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInlineHtmlOpenTag
  {
    \markdownRendererInlineHtmlOpenTagPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inlineHtmlOpenTag }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inlineHtmlOpenTag }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInlineHtmlCloseTag
  {
    \markdownRendererInlineHtmlCloseTagPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inlineHtmlCloseTag }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inlineHtmlCloseTag }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererInlineHtmlEmptyTag
  {
    \markdownRendererInlineHtmlEmptyTagPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inlineHtmlEmptyTag }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inlineHtmlEmptyTag }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererContentBlock
  {
    \markdownRendererContentBlockPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { contentBlock }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { contentBlock }
  { 4 }
\cs_gset_protected:Npn
  \markdownRendererContentBlockOnlineImage
  {
    \markdownRendererContentBlockOnlineImagePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { contentBlockOnlineImage }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { contentBlockOnlineImage }
  { 4 }
\cs_gset_protected:Npn
  \markdownRendererContentBlockCode
  {
    \markdownRendererContentBlockCodePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { contentBlockCode }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { contentBlockCode }
  { 5 }
\cs_gset_protected:Npn
  \markdownRendererDlBegin
  {
    \markdownRendererDlBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { dlBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { dlBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererDlBeginTight
  {
    \markdownRendererDlBeginTightPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { dlBeginTight }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { dlBeginTight }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererDlItem
  {
    \markdownRendererDlItemPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { dlItem }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { dlItem }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererDlItemEnd
  {
    \markdownRendererDlItemEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { dlItemEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { dlItemEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererDlDefinitionBegin
  {
    \markdownRendererDlDefinitionBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { dlDefinitionBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { dlDefinitionBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererDlDefinitionEnd
  {
    \markdownRendererDlDefinitionEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { dlDefinitionEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { dlDefinitionEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererDlEnd
  {
    \markdownRendererDlEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { dlEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { dlEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererDlEndTight
  {
    \markdownRendererDlEndTightPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { dlEndTight }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { dlEndTight }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererEllipsis
  {
    \markdownRendererEllipsisPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { ellipsis }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { ellipsis }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererEmphasis
  {
    \markdownRendererEmphasisPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { emphasis }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { emphasis }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererStrongEmphasis
  {
    \markdownRendererStrongEmphasisPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { strongEmphasis }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { strongEmphasis }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererFencedCodeAttributeContextBegin
  {
    \markdownRendererFencedCodeAttributeContextBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { fencedCodeAttributeContextBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { fencedCodeAttributeContextBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererFencedCodeAttributeContextEnd
  {
    \markdownRendererFencedCodeAttributeContextEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { fencedCodeAttributeContextEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { fencedCodeAttributeContextEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererFencedDivAttributeContextBegin
  {
    \markdownRendererFencedDivAttributeContextBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { fencedDivAttributeContextBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { fencedDivAttributeContextBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererFencedDivAttributeContextEnd
  {
    \markdownRendererFencedDivAttributeContextEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { fencedDivAttributeContextEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { fencedDivAttributeContextEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererHeaderAttributeContextBegin
  {
    \markdownRendererHeaderAttributeContextBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { headerAttributeContextBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { headerAttributeContextBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererHeaderAttributeContextEnd
  {
    \markdownRendererHeaderAttributeContextEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { headerAttributeContextEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { headerAttributeContextEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererHeadingOne
  {
    \markdownRendererHeadingOnePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { headingOne }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { headingOne }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererHeadingTwo
  {
    \markdownRendererHeadingTwoPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { headingTwo }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { headingTwo }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererHeadingThree
  {
    \markdownRendererHeadingThreePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { headingThree }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { headingThree }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererHeadingFour
  {
    \markdownRendererHeadingFourPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { headingFour }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { headingFour }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererHeadingFive
  {
    \markdownRendererHeadingFivePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { headingFive }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { headingFive }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererHeadingSix
  {
    \markdownRendererHeadingSixPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { headingSix }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { headingSix }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererImage
  {
    \markdownRendererImagePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { image }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { image }
  { 4 }
\cs_gset_protected:Npn
  \markdownRendererImageAttributeContextBegin
  {
    \markdownRendererImageAttributeContextBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { imageAttributeContextBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { imageAttributeContextBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererImageAttributeContextEnd
  {
    \markdownRendererImageAttributeContextEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { imageAttributeContextEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { imageAttributeContextEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererInterblockSeparator
  {
    \markdownRendererInterblockSeparatorPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { interblockSeparator }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { interblockSeparator }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererParagraphSeparator
  {
    \markdownRendererParagraphSeparatorPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { paragraphSeparator }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { paragraphSeparator }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererLineBlockBegin
  {
    \markdownRendererLineBlockBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { lineBlockBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { lineBlockBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererLineBlockEnd
  {
    \markdownRendererLineBlockEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { lineBlockEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { lineBlockEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererSoftLineBreak
  {
    \markdownRendererSoftLineBreakPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { softLineBreak }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { softLineBreak }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererHardLineBreak
  {
    \markdownRendererHardLineBreakPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { hardLineBreak }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { hardLineBreak }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererLink
  {
    \markdownRendererLinkPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { link }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { link }
  { 4 }
\cs_gset_protected:Npn
  \markdownRendererLinkAttributeContextBegin
  {
    \markdownRendererLinkAttributeContextBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { linkAttributeContextBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { linkAttributeContextBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererLinkAttributeContextEnd
  {
    \markdownRendererLinkAttributeContextEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { linkAttributeContextEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { linkAttributeContextEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererMark
  {
    \markdownRendererMarkPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { mark }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { mark }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererDocumentBegin
  {
    \markdownRendererDocumentBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { documentBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { documentBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererDocumentEnd
  {
    \markdownRendererDocumentEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { documentEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { documentEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererNbsp
  {
    \markdownRendererNbspPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { nbsp }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { nbsp }
  { 0 }
\ExplSyntaxOff
\def\markdownRendererNote{%
  \markdownRendererNotePrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { note }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { note }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererOlBegin
  {
    \markdownRendererOlBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { olBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { olBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererOlBeginTight
  {
    \markdownRendererOlBeginTightPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { olBeginTight }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { olBeginTight }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererFancyOlBegin
  {
    \markdownRendererFancyOlBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { fancyOlBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { fancyOlBegin }
  { 2 }
\cs_gset_protected:Npn
  \markdownRendererFancyOlBeginTight
  {
    \markdownRendererFancyOlBeginTightPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { fancyOlBeginTight }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { fancyOlBeginTight }
  { 2 }
\cs_gset_protected:Npn
  \markdownRendererOlItem
  {
    \markdownRendererOlItemPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { olItem }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { olItem }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererOlItemEnd
  {
    \markdownRendererOlItemEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { olItemEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { olItemEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererOlItemWithNumber
  {
    \markdownRendererOlItemWithNumberPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { olItemWithNumber }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { olItemWithNumber }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererFancyOlItem
  {
    \markdownRendererFancyOlItemPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { fancyOlItem }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { fancyOlItem }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererFancyOlItemEnd
  {
    \markdownRendererFancyOlItemEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { fancyOlItemEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { fancyOlItemEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererFancyOlItemWithNumber
  {
    \markdownRendererFancyOlItemWithNumberPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { fancyOlItemWithNumber }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { fancyOlItemWithNumber }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererOlEnd
  {
    \markdownRendererOlEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { olEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { olEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererOlEndTight
  {
    \markdownRendererOlEndTightPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { olEndTight }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { olEndTight }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererFancyOlEnd
  {
    \markdownRendererFancyOlEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { fancyOlEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { fancyOlEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererFancyOlEndTight
  {
    \markdownRendererFancyOlEndTightPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { fancyOlEndTight }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { fancyOlEndTight }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererInputRawInline
  {
    \markdownRendererInputRawInlinePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inputRawInline }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inputRawInline }
  { 2 }
\cs_gset_protected:Npn
  \markdownRendererInputRawBlock
  {
    \markdownRendererInputRawBlockPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inputRawBlock }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inputRawBlock }
  { 2 }
\cs_gset_protected:Npn
  \markdownRendererSectionBegin
  {
    \markdownRendererSectionBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { sectionBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { sectionBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererSectionEnd
  {
    \markdownRendererSectionEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { sectionEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { sectionEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererReplacementCharacter
  {
    \markdownRendererReplacementCharacterPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { replacementCharacter }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { replacementCharacter }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererLeftBrace
  {
    \markdownRendererLeftBracePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { leftBrace }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { leftBrace }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererRightBrace
  {
    \markdownRendererRightBracePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { rightBrace }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { rightBrace }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererDollarSign
  {
    \markdownRendererDollarSignPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { dollarSign }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { dollarSign }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererPercentSign
  {
    \markdownRendererPercentSignPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { percentSign }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { percentSign }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererAmpersand
  {
    \markdownRendererAmpersandPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { ampersand }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { ampersand }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererUnderscore
  {
    \markdownRendererUnderscorePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { underscore }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { underscore }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererHash
  {
    \markdownRendererHashPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { hash }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { hash }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererCircumflex
  {
    \markdownRendererCircumflexPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { circumflex }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { circumflex }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererBackslash
  {
    \markdownRendererBackslashPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { backslash }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { backslash }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererTilde
  {
    \markdownRendererTildePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { tilde }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { tilde }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererPipe
  {
    \markdownRendererPipePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { pipe }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { pipe }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererStrikeThrough
  {
    \markdownRendererStrikeThroughPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { strikeThrough }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { strikeThrough }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererSubscript
  {
    \markdownRendererSubscriptPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { subscript }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { subscript }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererSuperscript
  {
    \markdownRendererSuperscriptPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { superscript }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { superscript }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererTableAttributeContextBegin
  {
    \markdownRendererTableAttributeContextBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { tableAttributeContextBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { tableAttributeContextBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererTableAttributeContextEnd
  {
    \markdownRendererTableAttributeContextEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { tableAttributeContextEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { tableAttributeContextEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererTable
  {
    \markdownRendererTablePrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { table }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { table }
  { 3 }
\cs_gset_protected:Npn
  \markdownRendererInlineMath
  {
    \markdownRendererInlineMathPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { inlineMath }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { inlineMath }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererDisplayMath
  {
    \markdownRendererDisplayMathPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { displayMath }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { displayMath }
  { 1 }
\cs_gset_protected:Npn
  \markdownRendererThematicBreak
  {
    \markdownRendererThematicBreakPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { thematicBreak }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { thematicBreak }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererTickedBox
  {
    \markdownRendererTickedBoxPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { tickedBox }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { tickedBox }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererHalfTickedBox
  {
    \markdownRendererHalfTickedBoxPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { halfTickedBox }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { halfTickedBox }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererUntickedBox
  {
    \markdownRendererUntickedBoxPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { untickedBox }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { untickedBox }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererWarning
  {
    \markdownRendererWarningPrototype
  }
\cs_gset_protected:Npn
  \markdownRendererError
  {
    \markdownRendererErrorPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { warning }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { warning }
  { 4 }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { error }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { error }
  { 4 }
\cs_gset_protected:Npn
  \markdownRendererJekyllDataBegin
  {
    \markdownRendererJekyllDataBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataBegin }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererJekyllDataEnd
  {
    \markdownRendererJekyllDataEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererJekyllDataMappingBegin
  {
    \markdownRendererJekyllDataMappingBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataMappingBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataMappingBegin }
  { 2 }
\cs_gset_protected:Npn
  \markdownRendererJekyllDataMappingEnd
  {
    \markdownRendererJekyllDataMappingEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataMappingEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataMappingEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererJekyllDataSequenceBegin
  {
    \markdownRendererJekyllDataSequenceBeginPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataSequenceBegin }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataSequenceBegin }
  { 2 }
\cs_gset_protected:Npn
  \markdownRendererJekyllDataSequenceEnd
  {
    \markdownRendererJekyllDataSequenceEndPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataSequenceEnd }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataSequenceEnd }
  { 0 }
\cs_gset_protected:Npn
  \markdownRendererJekyllDataBoolean
  {
    \markdownRendererJekyllDataBooleanPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataBoolean }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataBoolean }
  { 2 }
\cs_gset_protected:Npn
  \markdownRendererJekyllDataNumber
  {
    \markdownRendererJekyllDataNumberPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataNumber }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataNumber }
  { 2 }
\cs_gset_protected:Npn
  \markdownRendererJekyllDataTypographicString
  {
    \markdownRendererJekyllDataTypographicStringPrototype
  }
\cs_gset_protected:Npn
  \markdownRendererJekyllDataProgrammaticString
  {
    \markdownRendererJekyllDataProgrammaticStringPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataTypographicString }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataTypographicString }
  { 2 }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataProgrammaticString }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataProgrammaticString }
  { 2 }
\cs_gset:Npn
  \markdownRendererJekyllDataTypographicString
  {
    \cs_if_exist:NTF
      \markdownRendererJekyllDataString
      {
        \__markdown_if_option:nTF
          { experimental }
          {
            \markdownError
              {
                The~jekyllDataString~renderer~has~been~deprecated,~
                to~be~removed~in~Markdown~4.0.0
              }
          }
          {
            \markdownWarning
              {
                The~jekyllDataString~renderer~has~been~deprecated,~
                to~be~removed~in~Markdown~4.0.0
              }
            \markdownRendererJekyllDataString
          }
      }
      {
        \cs_if_exist:NTF
          \markdownRendererJekyllDataStringPrototype
          {
            \__markdown_if_option:nTF
              { experimental }
              {
                \markdownError
                  {
                    The~jekyllDataString~renderer~prototype~
                    has~been~deprecated,~
                    to~be~removed~in~Markdown~4.0.0
                  }
              }
              {
                \markdownWarning
                  {
                    The~jekyllDataString~renderer~prototype~
                    has~been~deprecated,~
                    to~be~removed~in~Markdown~4.0.0
                  }
                \markdownRendererJekyllDataStringPrototype
              }
          }
          {
            \markdownRendererJekyllDataTypographicStringPrototype
          }
      }
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataString }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataString }
  { 2 }
\cs_gset_protected:Npn
  \markdownRendererJekyllDataEmpty
  {
    \markdownRendererJekyllDataEmptyPrototype
  }
\seq_gput_right:Nn
  \g__markdown_renderers_seq
  { jekyllDataEmpty }
\prop_gput:Nnn
  \g__markdown_renderer_arities_prop
  { jekyllDataEmpty }
  { 1 }
\cs_new_protected:Nn \__markdown_define_renderers:
  {
    \seq_map_inline:Nn
      \g__markdown_renderers_seq
      {
        \__markdown_define_renderer:n
          { ##1 }
      }
  }
\cs_new_protected:Nn \__markdown_define_renderer:n
  {
    \__markdown_renderer_tl_to_csname:nN
      { #1 }
      \l_tmpa_tl
    \prop_get:NnN
      \g__markdown_renderer_arities_prop
      { #1 }
      \l_tmpb_tl
    \__markdown_define_renderer:ncV
      { #1 }
      { \l_tmpa_tl }
      \l_tmpb_tl
  }
\cs_new_protected:Nn \__markdown_renderer_tl_to_csname:nN
  {
    \tl_set:Nn
      \l_tmpa_tl
      { \str_uppercase:n { #1 } }
    \tl_set:Nx
      #2
      {
        markdownRenderer
        \tl_head:f { \l_tmpa_tl }
        \tl_tail:n { #1 }
      }
  }
\tl_new:N
  \l__markdown_renderer_definition_tl
\bool_new:N
  \g__markdown_prepending_renderer_bool
\bool_new:N
  \g__markdown_appending_renderer_bool
\bool_new:N
  \g__markdown_unprotected_renderer_bool
\cs_new_protected:Nn \__markdown_define_renderer:nNn
  {
    \keys_define:nn
      { markdown/options/renderers }
      {
        #1 .value_required:n = { true },
        #1 .code:n = {
          \tl_set:Nn
            \l__markdown_renderer_definition_tl
            { ##1 }
          \regex_replace_all:nnN
            { \cP\#0 }
            { #1 }
            \l__markdown_renderer_definition_tl
          \bool_if:nT
            {
              \g__markdown_prepending_renderer_bool ||
              \g__markdown_appending_renderer_bool
            }
            {
              \__markdown_tl_set_from_cs:NNn
                \l_tmpa_tl
                #2
                { #3 }
              \bool_if:NTF
                \g__markdown_prepending_renderer_bool
                {
                  \tl_put_right:NV
                    \l__markdown_renderer_definition_tl
                    \l_tmpa_tl
                }
                {
                  \tl_put_left:NV
                    \l__markdown_renderer_definition_tl
                    \l_tmpa_tl
                }
            }
          \bool_if:NTF
            \g__markdown_unprotected_renderer_bool
            {
              \tl_set:Nn
                \l_tmpa_tl
                { \cs_set:Npn }
            }
            {
              \tl_set:Nn
                \l_tmpa_tl
                { \cs_set_protected:Npn }
            }
          \exp_last_unbraced:NNV
            \cs_generate_from_arg_count:NNnV
            #2
            \l_tmpa_tl
            { #3 }
            \l__markdown_renderer_definition_tl
        },
      }
    \str_if_eq:nnT
      { #1 }
      { jekyllDataString }
      {
        \cs_undefine:N
          #2
      }
  }
\cs_new_protected:Nn
  \__markdown_tl_set_from_cs:NNn
  {
    \tl_set:Nn
      \l_tmpa_tl
      { #2 }
    \int_step_inline:nn
      { #3 }
      {
        \exp_args:NNc
          \tl_put_right:Nn
          \l_tmpa_tl
          { __markdown_tl_set_from_cs_parameter_ ##1 }
      }
    \exp_args:NNV
      \tl_set:No
      \l_tmpb_tl
      \l_tmpa_tl
    \regex_replace_all:nnN
      { \cP. }
      { \0\0 }
      \l_tmpb_tl
    \int_step_inline:nn
      { #3 }
      {
        \regex_replace_all:nnN
          { \c { __markdown_tl_set_from_cs_parameter_ ##1 } }
          { \cP\# ##1 }
          \l_tmpb_tl
      }
    \tl_set:NV
      #1
      \l_tmpb_tl
  }
\cs_generate_variant:Nn
  \__markdown_define_renderer:nNn
  { ncV }
\cs_generate_variant:Nn
  \cs_generate_from_arg_count:NNnn
  { NNnV }
\cs_generate_variant:Nn
  \tl_put_left:Nn
  { Nv }
\keys_define:nn
  { markdown/options }
  {
    renderers .value_required:n = { true },
    renderers .code:n = {
      \bool_gset_false:N
        \g__markdown_unprotected_renderer_bool
      \keys_set:nn
        { markdown/options/renderers }
        { #1 }
    },
    unprotectedRenderers .value_required:n = { true },
    unprotectedRenderers .code:n = {
      \bool_gset_true:N
        \g__markdown_unprotected_renderer_bool
      \keys_set:nn
        { markdown/options/renderers }
        { #1 }
    },
  }
\tl_new:N
  \l__markdown_renderer_glob_definition_tl
\seq_new:N
  \l__markdown_renderer_glob_results_seq
\regex_const:Nn
  \c__markdown_prepending_key_regex
  { \^$ }
\regex_const:Nn
  \c__markdown_appending_key_regex
  { [\$+]$ }
\regex_const:Nn
  \c__markdown_prepending_or_appending_key_regex
  { [\^\$+]$ }
\keys_define:nn
  { markdown/options/renderers }
  {
    unknown .value_required:n = { true },
    unknown .code:n = {
      % TODO: Use `\regex_if_match` in TeX Live 2025.
      \regex_match:NVT
        \c__markdown_prepending_key_regex
        \l_keys_key_str
        {
          \bool_gset_true:N
            \g__markdown_prepending_renderer_bool
        }
      % TODO: Use `\regex_if_match` in TeX Live 2025.
      \regex_match:NVT
        \c__markdown_appending_key_regex
        \l_keys_key_str
        {
          \bool_gset_true:N
            \g__markdown_appending_renderer_bool
        }
      % TODO: Use `\regex_if_match` in TeX Live 2025.
      \regex_match:NVTF
        \c__markdown_prepending_or_appending_key_regex
        \l_keys_key_str
        {
          \tl_set:NV
            \l_tmpa_tl
            \l_keys_key_str
          \regex_replace_once:NnN
            \c__markdown_prepending_or_appending_key_regex
            { }
            \l_tmpa_tl
          \tl_set:Nx
            \l_tmpb_tl
            { { \l_tmpa_tl } = }
          \tl_put_right:Nn
            \l_tmpb_tl
            { { #1 } }
          \keys_set:nV
            { markdown/options/renderers }
            \l_tmpb_tl
          \bool_gset_false:N
            \g__markdown_prepending_renderer_bool
          \bool_gset_false:N
            \g__markdown_appending_renderer_bool
        }
        {
          \__markdown_glob_seq:VnN
            \l_keys_key_str
            { g__markdown_renderers_seq }
            \l__markdown_renderer_glob_results_seq
          \seq_if_empty:NTF
            \l__markdown_renderer_glob_results_seq
            {
              \msg_error:nnV
                { markdown }
                { undefined-renderer }
                \l_keys_key_str
            }
            {
              \tl_set:Nn
                \l__markdown_renderer_glob_definition_tl
                { \exp_not:n { #1 } }
              \seq_map_inline:Nn
                \l__markdown_renderer_glob_results_seq
                {
                  \tl_set:Nn
                    \l_tmpa_tl
                    { { ##1 } = }
                  \tl_put_right:Nx
                    \l_tmpa_tl
                    { { \l__markdown_renderer_glob_definition_tl } }
                  \keys_set:nV
                    { markdown/options/renderers }
                    \l_tmpa_tl
                }
            }
        }
    },
  }
\msg_new:nnn
  { markdown }
  { undefined-renderer }
  {
    Renderer~#1~is~undefined.
  }
\cs_generate_variant:Nn
  \__markdown_glob_seq:nnN
  { VnN }
\cs_generate_variant:Nn
  \cs_generate_from_arg_count:NNnn
  { cNVV }
\cs_generate_variant:Nn
  \msg_error:nnn
  { nnV }
\prg_generate_conditional_variant:Nnn
  % TODO: Use `\regex_if_match` in TeX Live 2025.
  \regex_match:Nn  % noqa: w202
  { NV }
  { T, TF }
\prop_new:N
  \g__markdown_glob_cache_prop
\tl_new:N
  \l__markdown_current_glob_tl
\cs_new_protected:Nn
  \__markdown_glob_seq:nnN
  {
    \tl_set:Nn
      \l__markdown_current_glob_tl
      { ^ #1 $ }
    \prop_get:NeNTF
      \g__markdown_glob_cache_prop
      { #2 / \l__markdown_current_glob_tl }
      \l_tmpa_clist
      {
        \seq_set_from_clist:NN
          #3
          \l_tmpa_clist
      }
      {
        \seq_clear:N
          #3
        \regex_replace_all:nnN
          { \* }
          { .* }
          \l__markdown_current_glob_tl
        \regex_set:NV
          \l_tmpa_regex
          \l__markdown_current_glob_tl
        \seq_map_inline:cn
          { #2 }
          {
            % TODO: Use `\regex_if_match` in TeX Live 2025.
            \regex_match:NnT  % noqa: w202
              \l_tmpa_regex
              { ##1 }
              {
                \seq_put_right:Nn
                  #3
                  { ##1 }
              }
          }
        \clist_set_from_seq:NN
          \l_tmpa_clist
          #3
        \prop_gput:NeV
          \g__markdown_glob_cache_prop
          { #2 / \l__markdown_current_glob_tl }
          \l_tmpa_clist
      }
  }
\cs_generate_variant:Nn
  \regex_set:Nn
  { NV }
\cs_generate_variant:Nn
  \prop_gput:Nnn
  { NeV }
\str_if_eq:VVT
  \c__markdown_top_layer_tl
  \c__markdown_option_layer_plain_tex_tl
  {
    \__markdown_define_renderers:
  }
\keys_define:nn
  { markdown/jekyllData }
  { }
\__markdown_with_various_cases:nn
  { jekyllDataRenderers }
  {
    \keys_define:nn
      { markdown/options }
      {
        #1 .value_required:n = { true },
        #1 .code:n = {
          \tl_set:Nn
            \l_tmpa_tl
            { ##1 }
          \tl_replace_all:NnV
            \l_tmpa_tl
            { / }
            \c_backslash_str
          \keys_set:nV
            { markdown/options/jekyll-data-renderers }
            \l_tmpa_tl
        },
      }
  }
\keys_define:nn
  { markdown/options/jekyll-data-renderers }
  {
    unknown .value_required:n = { true },
    unknown .code:n = {
      \tl_set_eq:NN
        \l_tmpa_tl
        \l_keys_key_str
      \tl_replace_all:NVn
        \l_tmpa_tl
        \c_backslash_str
        { / }
      \tl_put_right:Nn
        \l_tmpa_tl
        {
          .code:n = { #1 }
        }
      \keys_define:nV
        { markdown/jekyllData }
        \l_tmpa_tl
    }
  }
\cs_new_protected:Nn \__markdown_define_renderer_prototypes:
  {
    \seq_map_inline:Nn
      \g__markdown_renderers_seq
      {
        \__markdown_define_renderer_prototype:n
          { ##1 }
      }
  }
\cs_new_protected:Nn \__markdown_define_renderer_prototype:n
  {
    \__markdown_renderer_prototype_tl_to_csname:nN
      { #1 }
      \l_tmpa_tl
    \prop_get:NnN
      \g__markdown_renderer_arities_prop
      { #1 }
      \l_tmpb_tl
    \__markdown_define_renderer_prototype:ncV
      { #1 }
      { \l_tmpa_tl }
      \l_tmpb_tl
  }
\cs_new_protected:Nn \__markdown_renderer_prototype_tl_to_csname:nN
  {
    \tl_set:Nn
      \l_tmpa_tl
      { \str_uppercase:n { #1 } }
    \tl_set:Nx
      #2
      {
        markdownRenderer
        \tl_head:f { \l_tmpa_tl }
        \tl_tail:n { #1 }
        Prototype
      }
  }
\tl_new:N
  \l__markdown_renderer_prototype_definition_tl
\bool_new:N
  \g__markdown_prepending_renderer_prototype_bool
\bool_new:N
  \g__markdown_appending_renderer_prototype_bool
\bool_new:N
  \g__markdown_unprotected_renderer_prototype_bool
\cs_new_protected:Nn \__markdown_define_renderer_prototype:nNn
  {
    \keys_define:nn
      { markdown/options/renderer-prototypes }
      {
        #1 .value_required:n = { true },
        #1 .code:n = {
          \tl_set:Nn
            \l__markdown_renderer_prototype_definition_tl
            { ##1 }
          \regex_replace_all:nnN
            { \cP\#0 }
            { #1 }
            \l__markdown_renderer_prototype_definition_tl
          \bool_if:nT
            {
              \g__markdown_prepending_renderer_prototype_bool ||
              \g__markdown_appending_renderer_prototype_bool
            }
            {
              \__markdown_tl_set_from_cs:NNn
                \l_tmpa_tl
                #2
                { #3 }
              \bool_if:NTF
                \g__markdown_prepending_renderer_prototype_bool
                {
                  \tl_put_right:NV
                    \l__markdown_renderer_prototype_definition_tl
                    \l_tmpa_tl
                }
                {
                  \tl_put_left:NV
                    \l__markdown_renderer_prototype_definition_tl
                    \l_tmpa_tl
                }
            }
          \bool_if:NTF
            \g__markdown_unprotected_renderer_prototype_bool
            {
              \tl_set:Nn
                \l_tmpa_tl
                { \cs_set:Npn }
            }
            {
              \tl_set:Nn
                \l_tmpa_tl
                { \cs_set_protected:Npn }
            }
          \exp_last_unbraced:NNV
            \cs_generate_from_arg_count:NNnV
            #2
            \l_tmpa_tl
            { #3 }
            \l__markdown_renderer_prototype_definition_tl
        },
      }
    \str_if_eq:nnF
      { #1 }
      { jekyllDataString }
      {
        \cs_if_free:NT
          #2
          {
            \cs_generate_from_arg_count:NNnn
              #2
              \cs_gset_protected:Npn
              { #3 }
              { }
          }
      }
  }
\cs_generate_variant:Nn
  \__markdown_define_renderer_prototype:nNn
  { ncV }
\keys_define:nn
  { markdown/options/renderer-prototypes }
  {
    unknown .value_required:n = { true },
    unknown .code:n = {
      % TODO: Use `\regex_if_match` in TeX Live 2025.
      \regex_match:NVT
        \c__markdown_prepending_key_regex
        \l_keys_key_str
        {
          \bool_gset_true:N
            \g__markdown_prepending_renderer_prototype_bool
        }
      % TODO: Use `\regex_if_match` in TeX Live 2025.
      \regex_match:NVT
        \c__markdown_appending_key_regex
        \l_keys_key_str
        {
          \bool_gset_true:N
            \g__markdown_appending_renderer_prototype_bool
        }
      % TODO: Use `\regex_if_match` in TeX Live 2025.
      \regex_match:NVTF
        \c__markdown_prepending_or_appending_key_regex
        \l_keys_key_str
        {
          \tl_set:NV
            \l_tmpa_tl
            \l_keys_key_str
          \regex_replace_once:NnN
            \c__markdown_prepending_or_appending_key_regex
            { }
            \l_tmpa_tl
          \tl_set:Nx
            \l_tmpb_tl
            { { \l_tmpa_tl } = }
          \tl_put_right:Nn
            \l_tmpb_tl
            { { #1 } }
          \keys_set:nV
            { markdown/options/renderer-prototypes }
            \l_tmpb_tl
          \bool_gset_false:N
            \g__markdown_prepending_renderer_prototype_bool
          \bool_gset_false:N
            \g__markdown_appending_renderer_prototype_bool
        }
        {
          \__markdown_glob_seq:VnN
            \l_keys_key_str
            { g__markdown_renderers_seq }
            \l__markdown_renderer_glob_results_seq
          \seq_if_empty:NTF
            \l__markdown_renderer_glob_results_seq
            {
              \msg_error:nnV
                { markdown }
                { undefined-renderer-prototype }
                \l_keys_key_str
            }
            {
              \tl_set:Nn
                \l__markdown_renderer_glob_definition_tl
                { \exp_not:n { #1 } }
              \seq_map_inline:Nn
                \l__markdown_renderer_glob_results_seq
                {
                  \tl_set:Nn
                    \l_tmpa_tl
                    { { ##1 } = }
                  \tl_put_right:Nx
                    \l_tmpa_tl
                    { { \l__markdown_renderer_glob_definition_tl } }
                  \keys_set:nV
                    { markdown/options/renderer-prototypes }
                    \l_tmpa_tl
                }
            }
        }
    },
  }
\msg_new:nnn
  { markdown }
  { undefined-renderer-prototype }
  {
    Renderer~prototype~#1~is~undefined.
  }
\__markdown_with_various_cases:nn
  { rendererPrototypes }
  {
    \keys_define:nn
      { markdown/options }
      {
        #1 .value_required:n = { true },
        #1 .code:n = {
          \bool_gset_false:N
            \g__markdown_unprotected_renderer_prototype_bool
          \keys_set:nn
            { markdown/options/renderer-prototypes }
            { ##1 }
        },
      }
  }
\__markdown_with_various_cases:nn
  { unprotectedRendererPrototypes }
  {
    \keys_define:nn
      { markdown/options }
      {
        #1 .value_required:n = { true },
        #1 .code:n = {
          \bool_gset_true:N
            \g__markdown_unprotected_renderer_prototype_bool
          \keys_set:nn
            { markdown/options/renderer-prototypes }
            { ##1 }
        },
      }
  }
\str_if_eq:VVT
  \c__markdown_top_layer_tl
  \c__markdown_option_layer_plain_tex_tl
  {
    \__markdown_define_renderer_prototypes:
  }
\ExplSyntaxOff
\let\markdownMakeOther\relax
\let\markdownReadAndConvert\relax
\begingroup
  \catcode`\|=0\catcode`\\=12%
  |gdef|markdownBegin{%
    |markdownReadAndConvert{\markdownEnd}%
                           {|markdownEnd}}%
  |gdef|yamlBegin{%
    |begingroup
    |yamlSetup{jekyllData, expectJekyllData, ensureJekyllData}%
    |markdownReadAndConvert{\yamlEnd}%
                           {|yamlEnd}}%
|endgroup
\ExplSyntaxOn
\keys_define:nn
  { markdown/options }
  {
    code .value_required:n = { true },
    code .code:n = { #1 },
  }
\cs_if_free:NT
  \markdownInfo
  {
    \cs_new_protected:Npn
      \markdownInfo #1
      {
        \msg_info:nne
          { markdown }
          { generic-message }
          { #1 }
      }
  }
\cs_if_free:NT
  \markdownWarning
  {
    \cs_new_protected:Npn
      \markdownWarning #1
      {
        \msg_warning:nne
          { markdown }
          { generic-message }
          { #1 }
      }
  }
\cs_if_free:NT
  \markdownError
  {
    \cs_new_protected:Npn
      \markdownError #1 #2
      {
        \msg_error:nnee
          { markdown }
          { generic-message-with-help-text }
          { #1 }
          { #2 }
      }
  }
\msg_new:nnn
  { markdown }
  { generic-message }
  { #1 }
\msg_new:nnnn
  { markdown }
  { generic-message-with-help-text }
  { #1 }
  { #2 }
\cs_generate_variant:Nn
  \msg_info:nnn
  { nne }
\cs_generate_variant:Nn
  \msg_warning:nnn
  { nne }
\cs_generate_variant:Nn
  \msg_error:nnnn
  { nnee }
\prop_new:N \g__markdown_plain_tex_loaded_themes_linenos_prop
\prop_new:N \g__markdown_plain_tex_loaded_themes_versions_prop
\cs_new_protected:Nn
  \__markdown_plain_tex_load_theme:nnn
  {
    \prop_get:NnNTF
      \g__markdown_plain_tex_loaded_themes_linenos_prop
      { #1 }
      \l_tmpa_tl
      {
        \prop_get:NnN
          \g__markdown_plain_tex_loaded_themes_versions_prop
          { #1 }
          \l_tmpb_tl
        \str_if_eq:nVTF
          { #2 }
          \l_tmpb_tl
          {
            \msg_warning:nnnVn
              { markdown }
              { repeatedly-loaded-plain-tex-theme }
              { #1 }
              \l_tmpa_tl
              { #2 }
          }
          {
            \msg_error:nnnnVV
              { markdown }
              { different-versions-of-plain-tex-theme }
              { #1 }
              { #2 }
              \l_tmpb_tl
              \l_tmpa_tl
          }
      }
      {
        \prop_gput:Nnx
          \g__markdown_plain_tex_loaded_themes_linenos_prop
          { #1 }
          { \tex_the:D \tex_inputlineno:D }  % noqa: W200
        \prop_gput:Nnn
          \g__markdown_plain_tex_loaded_themes_versions_prop
          { #1 }
          { #2 }
        \prop_if_in:NnTF
          \g__markdown_plain_tex_built_in_themes_prop
          { #1 }
          {
            \msg_info:nnnn
              { markdown }
              { loading-built-in-plain-tex-theme }
              { #1 }
              { #2 }
            \prop_item:Nn
              \g__markdown_plain_tex_built_in_themes_prop
              { #1 }
          }
          {
            \msg_info:nnnn
              { markdown }
              { loading-plain-tex-theme }
              { #1 }
              { #2 }
            \file_input:n
              { markdown theme #3 }
          }
      }
  }
\msg_new:nnn
  { markdown }
  { loading-plain-tex-theme }
  { Loading~version~#2~of~plain~TeX~Markdown~theme~#1 }
\msg_new:nnn
  { markdown }
  { loading-built-in-plain-tex-theme }
  { Loading~version~#2~of~built-in~plain~TeX~Markdown~theme~#1 }
\msg_new:nnn
  { markdown }
  { repeatedly-loaded-plain-tex-theme }
  {
    Version~#3~of~plain~TeX~Markdown~theme~#1~was~previously~
    loaded~on~line~#2,~not~loading~it~again
  }
\msg_new:nnn
  { markdown }
  { different-versions-of-plain-tex-theme }
  {
    Tried~to~load~version~#2~of~plain~TeX~Markdown~theme~#1~
    but~version~#3~has~already~been~loaded~on~line~#4
  }
\cs_generate_variant:Nn
  \prop_gput:Nnn
  { Nnx }
\cs_gset_eq:NN
  \__markdown_load_theme:nnn
  \__markdown_plain_tex_load_theme:nnn
\cs_generate_variant:Nn
  \__markdown_load_theme:nnn
  { VeV }
\cs_generate_variant:Nn
  \msg_error:nnnnnn
  { nnnnVV }
\cs_generate_variant:Nn
  \msg_warning:nnnnn
  { nnnVn }
\cs_new_protected:Npn
  \markdownLoadPlainTeXTheme
  {
    \tl_set:NV
      \l_tmpa_tl
      \g__markdown_current_theme_tl
    \tl_reverse:N
      \l_tmpa_tl
    \tl_set:Ne
      \l_tmpb_tl
      {
        \tl_tail:V
          \l_tmpa_tl
      }
    \tl_reverse:N
      \l_tmpb_tl
    \str_set:NV
      \l_tmpa_str
      \l_tmpb_tl
    \str_replace_all:Nnn
      \l_tmpa_str
      { / }
      { _ }
    \__markdown_plain_tex_load_theme:VeV
      \l_tmpb_tl
      { \markdownThemeVersion }
      \l_tmpa_str
  }
\cs_generate_variant:Nn
  \tl_set:Nn
  { Ne }
\cs_generate_variant:Nn
  \__markdown_plain_tex_load_theme:nnn
  { VeV }
\prop_gput:Nnn
  \g__markdown_plain_tex_built_in_themes_prop
  { witiko / dot }
  {
    \str_if_eq:enF
      { \markdownThemeVersion }
      { silent }
      {
        \markdownWarning
          {
            The~theme~name~"witiko/dot"~has~been~soft-deprecated.
            \iow_newline:
            Consider~changing~the~name~to~"witiko/diagrams@v1".
          }
      }
    \markdownSetup { fencedCode }
    \cs_set_eq:NN
      \__markdown_dot_previous_definition:nnn
      \markdownRendererInputFencedCodePrototype
    \regex_const:Nn
      \c__markdown_dot_infostring_regex
      { ^dot(\s+(.+))? }
    \seq_new:N
      \l__markdown_dot_matches_seq
    \markdownSetup {
      rendererPrototypes = {
        inputFencedCode = {
          \regex_extract_once:NnNTF
            \c__markdown_dot_infostring_regex
            { #2 }
            \l__markdown_dot_matches_seq
            {
              \__markdown_if_option:nF
                { frozenCache }
                {
                  \sys_shell_now:n
                    {
                      if~!~test~-e~#1.pdf.source~
                      ||~!~diff~#1~#1.pdf.source;
                      then~
                        dot~-Tpdf~-o~#1.pdf~#1;
                        cp~#1~#1.pdf.source;
                      fi
                    }
                }
              \exp_args:NNne
                \exp_last_unbraced:No
                \markdownRendererImage
                  {
                    { Graphviz~image }
                    { #1.pdf }
                    { #1.pdf }
                  }
                  {
                    \seq_item:Nn
                      \l__markdown_dot_matches_seq
                      { 3 }
                  }
            }
            {
              \__markdown_dot_previous_definition:nnn
                { #1 }
                { #2 }
                { #3 }
            }
        },
      },
    }
  }
\prop_gput:Nnn
  \g__markdown_plain_tex_built_in_themes_prop
  { witiko / diagrams }
  {
    \str_case:enF
      { \markdownThemeVersion }
      {
        { latest }
          {
            \msg_warning:nnnn
              { markdown }
              { pin-theme-version }
              { witiko/diagrams }
              { v2 }
            \markdownSetup
              {
                import = witiko/diagrams/v2,
              }
          }
        { v2 }
          {
            \markdownSetup
              {
                import = witiko/diagrams/v2,
              }
          }
        { v1 }
          {
            \markdownSetup
              {
                import = witiko/dot@silent,
              }
          }
      }
      {
        \msg_error:nnnen
          { markdown }
          { unknown-theme-version }
          { witiko/diagrams }
          { \markdownThemeVersion }
          { v1~and~v2 }
      }
  }
\cs_generate_variant:Nn
  \msg_error:nnnnn
  { nnnen }
\msg_new:nnn
  { markdown }
  { pin-theme-version }
  {
    Write~"#1@#2"~to~pin~version~"#2"~of~the~theme~"#1".
    This~will~keep~your~documents~from~suddenly~breaking
    when~we~have~released~future~versions~of~the~theme
    with~backwards-incompatible~syntax~and~behavior.
  }
\msg_new:nnnn
  { markdown }
  { unknown-theme-version }
  { Unknown~version~"#2"~of~theme~"#1"~has~been~requested. }
  { Known~versions~are:~#3 }
\prop_gput:Nnn
  \g__markdown_plain_tex_built_in_themes_prop
  { witiko / diagrams / v2 }
  {
    \__markdown_setup:n
      {
        fencedCode = true,
        fencedCodeAttributes = true,
      }
    \cs_set_eq:NN
      \__markdown_diagrams_previous_fenced_code:nnn
      \markdownRendererInputFencedCodePrototype
    \tl_new:N
      \l__markdown_diagrams_caption_tl
    \tl_new:N
      \l__markdown_diagrams_format_tl
    \tl_set:Nn
      \l__markdown_diagrams_format_tl
      { pdf }
    \tl_new:N
      \l__markdown_diagrams_command_tl
    \__markdown_setup:n
      {
        rendererPrototypes = {
          fencedCodeAttributeContextBegin = {
            \group_begin:
            \markdownRendererImageAttributeContextBegin
            \cs_set_eq:NN
              \__markdown_diagrams_previous_key_value:nn
              \markdownRendererAttributeKeyValuePrototype
            \__markdown_setup:n
              {
                rendererPrototypes = {
                  attributeKeyValue = {
                    \str_case:nnF
                      { ##1 }
                      {
                        { caption }
                          {
                            \tl_set:Nn
                              \l__markdown_diagrams_caption_tl
                              { ##2 }
                          }
                        { format }
                          {
                            \tl_set:Nn
                              \l__markdown_diagrams_format_tl
                              { ##2 }
                          }
                        { command }
                          {
                            \tl_set:Nn
                              \l__markdown_diagrams_command_tl
                              { ##2 }
                          }
                      }
                      {
                        \__markdown_diagrams_previous_key_value:nn
                          { ##1 }
                          { ##2 }
                      }
                  },
                },
              }
          },
          fencedCodeAttributeContextEnd = {
            \markdownRendererImageAttributeContextEnd
            \group_end:
          },
        },
      }
    \cs_new:Nn
      \__markdown_diagrams_render_diagram:nnnn
      {
        \__markdown_if_option:nF
          { frozenCache }
          {
            \sys_shell_now:n
              {
                if~!~test~-e~#2.source~
                ||~!~diff~#1~#2.source;
                then~
                  (#3);
                  cp~#1~#2.source;
                fi
              }
            \exp_args:NNnV
              \exp_last_unbraced:No
              \markdownRendererImage
                {
                  { #4 }
                  { #2 }
                  { #2 }
                }
                \l__markdown_diagrams_caption_tl
          }
      }
    \prop_new:N
      \g_markdown_diagrams_infostrings_prop
    \__markdown_setup:n
      {
        rendererPrototypes = {
          inputFencedCode = {
            \prop_get:NnNTF
              \g_markdown_diagrams_infostrings_prop
              { #2 }
              \l_tmpa_tl
              {
                \cs_set:NV
                  \__markdown_diagrams_infostrings_current:n
                  \l_tmpa_tl
                \__markdown_diagrams_infostrings_current:n
                  { #1 }
              }
              {
                \__markdown_diagrams_previous_fenced_code:nnn
                  { #1 }
                  { #2 }
                  { #3 }
              }
          },
        },
      }
    \cs_generate_variant:Nn
      \cs_set:Nn
      { NV }
    \cs_set:Nn
      \__markdown_diagrams_infostrings_current:n
      {
        \tl_set:Nn
          \l_tmpb_tl
          { dot~-T }
        \tl_put_right:NV
          \l_tmpb_tl
          \l__markdown_diagrams_format_tl
        \tl_put_right:Nn
          \l_tmpb_tl
          { ~-o~#1. }
        \tl_put_right:NV
          \l_tmpb_tl
          \l__markdown_diagrams_format_tl
        \tl_put_right:Nn
          \l_tmpb_tl
          { ~#1 }
        \str_if_eq:VnT
          \l__markdown_diagrams_format_tl
          { svg }
          {
            \tl_put_right:Nn
              \l_tmpb_tl
              { ;~inkscape~#1. }
            \tl_put_right:NV
              \l_tmpb_tl
              \l__markdown_diagrams_format_tl
            \tl_put_right:Nn
              \l_tmpb_tl
              { ~--export-area-drawing~--export-dpi=300~-o~#1.pdf }
          }
        \__markdown_diagrams_render_diagram:nnVn
          { #1 }
          { #1.pdf }
          \l_tmpb_tl
          { Graphviz~image }
      }
    \cs_generate_variant:Nn
      \__markdown_diagrams_render_diagram:nnnn
      { nnVn }
    \__markdown_tl_set_from_cs:NNn
      \l_tmpa_tl
      \__markdown_diagrams_infostrings_current:n
      { 1 }
    \prop_gput:NnV
      \g_markdown_diagrams_infostrings_prop
      { dot }
      \l_tmpa_tl
    \tl_new:N
      \g__markdown_diagrams_mmdc_command_tl
    \tl_gset:Nn
      \g__markdown_diagrams_mmdc_command_tl
      {
        \tl_if_empty:NTF
          \l__markdown_diagrams_command_tl
          { mmdc }
          {
            \tl_use:N
              \l__markdown_diagrams_command_tl
          }
      }
    \cs_if_free:NT
      \mmdcCommand
      {
        \cs_new:Npn
          \mmdcCommand
          {
            \tl_use:N
              \g__markdown_diagrams_mmdc_command_tl
          }
      }
    \cs_set:Nn
      \__markdown_diagrams_infostrings_current:n
      {
        \tl_set:Nx
          \l_tmpb_tl
          { \mmdcCommand }
        \tl_put_right:Nn
          \l_tmpb_tl
          { ~--pdfFit~-i~#1~-o~#1.pdf }
        \__markdown_diagrams_render_diagram:nnVn
          { #1 }
          { #1.pdf }
          \l_tmpb_tl
          { Mermaid~image }
      }
    \__markdown_tl_set_from_cs:NNn
      \l_tmpa_tl
      \__markdown_diagrams_infostrings_current:n
      { 1 }
    \prop_gput:NnV
      \g_markdown_diagrams_infostrings_prop
      { mermaid }
      \l_tmpa_tl
    \regex_const:Nn
      \c__markdown_diagrams_filename_suffix_regex
      { \.[^.]*$ }
    \cs_set:Nn
      \__markdown_diagrams_infostrings_current:n
      {
        \tl_set:Nn
          \l_tmpa_tl
          { #1 }
        \regex_replace_once:NxN
          \c__markdown_diagrams_filename_suffix_regex
          {
            .
            \tl_use:N
              \l__markdown_diagrams_format_tl
          }
          \l_tmpa_tl
        \tl_set:Nn
          \l_tmpb_tl
          { plantuml~-t }
        \tl_put_right:NV
          \l_tmpb_tl
          \l__markdown_diagrams_format_tl
        \tl_put_right:Nn
          \l_tmpb_tl
          { ~#1 }
        \str_if_eq:VnT
          \l__markdown_diagrams_format_tl
          { svg }
          {
            \tl_put_right:Nn
              \l_tmpb_tl
              { ;~inkscape~ }
            \tl_put_right:NV
              \l_tmpb_tl
              \l_tmpa_tl
            \tl_put_right:Nn
              \l_tmpb_tl
              { ~--export-area-drawing~--export-dpi=300~-o~ }
            \tl_set:Nn
              \l_tmpa_tl
              { #1 }
            \regex_replace_once:NnN
              \c__markdown_diagrams_filename_suffix_regex
              { .pdf }
              \l_tmpa_tl
            \tl_put_right:NV
              \l_tmpb_tl
              \l_tmpa_tl
          }
        \__markdown_diagrams_render_diagram:nVVn
          { #1 }
          \l_tmpa_tl
          \l_tmpb_tl
          { PlantUML~image }
      }
    \cs_generate_variant:Nn
      \__markdown_diagrams_render_diagram:nnnn
      { nVVn }
    \cs_generate_variant:Nn
      \regex_replace_once:NnN
      { NxN }
    \__markdown_tl_set_from_cs:NNn
      \l_tmpa_tl
      \__markdown_diagrams_infostrings_current:n
      { 1 }
    \prop_gput:NnV
      \g_markdown_diagrams_infostrings_prop
      { plantuml }
      \l_tmpa_tl
  }
\group_begin:
\char_set_catcode_other:N \%
\prop_gput:Nnn
  \g__markdown_plain_tex_built_in_themes_prop
  { witiko / graphicx / http }
  {
    \cs_set_eq:NN
      \__markdown_graphicx_http_previous_definition:nnnn
      \markdownRendererImagePrototype
    \int_new:N
      \g__markdown_graphicx_http_image_number_int
    \int_gset:Nn
      \g__markdown_graphicx_http_image_number_int
      { 0 }
    \cs_new:Nn
      \__markdown_graphicx_http_filename:
      {
        \markdownOptionCacheDir
        / witiko_graphicx_http .
        \int_use:N
          \g__markdown_graphicx_http_image_number_int
      }
    \cs_new:Nn
      \__markdown_graphicx_http_download:nn
      {
        wget~-O~#2~#1~
        ||~curl~--location~-o~#2~#1~
        ||~rm~-f~#2
      }
    \str_new:N
      \l__markdown_graphicx_http_filename_str
    \ior_new:N
      \g__markdown_graphicx_http_filename_ior
    \markdownSetup {
      rendererPrototypes = {
        image = {
          \__markdown_if_option:nF
            { frozenCache }
            {
              \sys_shell_now:e
                {
                  mkdir~-p~" \markdownOptionCacheDir ";
                  if~printf~'%s'~"#3"~|~grep~-q~-E~'^https?:';
                  then~
                    OUTPUT_PREFIX=" \markdownOptionCacheDir ";
                    OUTPUT_BODY="$(printf~'%s'~'#3'
                                  |~md5sum~|~cut~-d'~'~-f1)";
                    OUTPUT_SUFFIX="$(printf~'%s'~'#3'
                                  |~sed~'s/.*[.]//')";
                    OUTPUT="$OUTPUT_PREFIX/$OUTPUT_BODY.$OUTPUT_SUFFIX";
                    if~!~[~-e~"$OUTPUT"~];
                    then~
                      \__markdown_graphicx_http_download:nn
                        { '#3' }
                        { "$OUTPUT" } ;
                      printf~'%s'~"$OUTPUT"~
                        >~" \__markdown_graphicx_http_filename: ";
                    fi;
                  else~
                    printf~'%s'~'#3'~
                      >~" \__markdown_graphicx_http_filename: ";
                  fi
                }
              }
          \ior_open:Ne
            \g__markdown_graphicx_http_filename_ior
            { \__markdown_graphicx_http_filename: }
          \ior_str_get:NN
            \g__markdown_graphicx_http_filename_ior
            \l__markdown_graphicx_http_filename_str
          \ior_close:N
            \g__markdown_graphicx_http_filename_ior
          \__markdown_graphicx_http_previous_definition:nnVn
            { #1 }
            { #2 }
            \l__markdown_graphicx_http_filename_str
            { #4 }
          \int_gincr:N
            \g__markdown_graphicx_http_image_number_int
        }
      }
    }
    \cs_generate_variant:Nn
      \ior_open:Nn
      { Ne }
    \cs_generate_variant:Nn
      \__markdown_graphicx_http_previous_definition:nnnn
      { nnVn }
  }
\group_end:
\prop_gput:Nnn
  \g__markdown_plain_tex_built_in_themes_prop
  { witiko / tilde }
  {
    \markdownSetup {
      rendererPrototypes = {
        tilde = {~},
      },
    }
  }
\clist_map_inline:nn
  { foo, bar }
  {
    \prop_gput:Nnn
      \g__markdown_plain_tex_built_in_themes_prop
      { witiko / example / #1 }
      {
        \markdownWarning
          {
            The~theme~witiko/example/#1~is~supposed~to~be~used~in~code~
            examples.~Using~it~in~actual~code~has~no~effect,~except~
            this~warning~message,~and~is~usually~a~mistake.
          }
      }
  }
\str_if_eq:VVT
  \c__markdown_top_layer_tl
  \c__markdown_option_layer_plain_tex_tl
  {
    \use:c
      { ExplSyntaxOff }
    \__markdown_if_option:nF
      { noDefaults }
      {
        \__markdown_if_option:nTF
          { experimental }
          {
            \__markdown_setup:n
              { theme = witiko/markdown/defaults@experimental }
          }
          {
            \__markdown_setup:n
              { theme = witiko/markdown/defaults }
          }
      }
    \use:c
      { ExplSyntaxOn }
  }
\tl_new:N \g__markdown_formatted_lua_options_tl
\cs_new_protected:Nn \__markdown_format_lua_options:
  {
    \tl_gclear:N
      \g__markdown_formatted_lua_options_tl
    \seq_map_function:NN
      \g__markdown_lua_options_seq
      \__markdown_format_lua_option:n
  }
\cs_new_protected:Nn \__markdown_format_lua_option:n
  {
    \__markdown_typecheck_option:n
      { #1 }
    \__markdown_get_option_type:nN
      { #1 }
      \l_tmpa_tl
    \bool_case_true:nF
      {
        {
          \str_if_eq_p:VV
            \l_tmpa_tl
            \c__markdown_option_type_boolean_tl ||
          \str_if_eq_p:VV
            \l_tmpa_tl
            \c__markdown_option_type_number_tl ||
          \str_if_eq_p:VV
            \l_tmpa_tl
            \c__markdown_option_type_counter_tl
        }
          {
            \__markdown_get_option_value:nN
              { #1 }
              \l_tmpa_tl
            \tl_gput_right:Nx
              \g__markdown_formatted_lua_options_tl
              { #1~=~ \l_tmpa_tl ,~ }
          }
        {
          \str_if_eq_p:VV
            \l_tmpa_tl
            \c__markdown_option_type_clist_tl
        }
          {
            \__markdown_get_option_value:nN
              { #1 }
              \l_tmpa_tl
            \tl_gput_right:Nx
              \g__markdown_formatted_lua_options_tl
              { #1~=~\c_left_brace_str }
            \clist_map_inline:Vn
              \l_tmpa_tl
              {
                \__markdown_lua_escape:xN
                  { ##1 }
                  \l_tmpb_tl
                \tl_gput_right:Nn
                  \g__markdown_formatted_lua_options_tl
                  { " }
                \tl_gput_right:NV
                  \g__markdown_formatted_lua_options_tl
                  \l_tmpb_tl
                \tl_gput_right:Nn
                  \g__markdown_formatted_lua_options_tl
                  { " ,~ }
              }
            \tl_gput_right:Nx
              \g__markdown_formatted_lua_options_tl
              { \c_right_brace_str ,~ }
          }
      }
      {
        \__markdown_get_option_value:nN
          { #1 }
          \l_tmpa_tl
        \__markdown_lua_escape:xN
          { \l_tmpa_tl }
          \l_tmpb_tl
        \tl_gput_right:Nn
          \g__markdown_formatted_lua_options_tl
          { #1~=~ " }
        \tl_gput_right:NV
          \g__markdown_formatted_lua_options_tl
          \l_tmpb_tl
        \tl_gput_right:Nn
          \g__markdown_formatted_lua_options_tl
          { " ,~ }
      }
  }
\cs_generate_variant:Nn
  \clist_map_inline:nn
  { Vn }
\let
  \markdownPrepareLuaOptions
  \__markdown_format_lua_options:
\def
  \markdownLuaOptions
    {
      {
        \g__markdown_formatted_lua_options_tl
      }
    }
\sys_if_engine_luatex:TF
  {
    \cs_new_protected:Nn
      \__markdown_lua_escape:nN
      {
        \tl_set:Nx
          #2
          {
            \lua_escape:n
              { #1 }
          }
      }
  }
  {
    \regex_const:Nn
      \c__markdown_lua_escape_regex
      { [\\"'] }
    \cs_new_protected:Nn
      \__markdown_lua_escape:nN
      {
        \tl_set:Nn
          #2
          { #1 }
        \regex_replace_all:NnN
          \c__markdown_lua_escape_regex
          { \u { c_backslash_str } \0 }
          #2
      }
  }
\cs_generate_variant:Nn
  \__markdown_lua_escape:nN
  { xN }
\tl_new:N
  \markdownInputFilename
\cs_new_protected:Npn
  \markdownPrepareInputFilename
  #1
  {
    \__markdown_lua_escape:xN
      { #1 }
      \markdownInputFilename
    \tl_gset:Nx
      \markdownInputFilename
      { " \markdownInputFilename " }
  }
\cs_new:Npn
  \markdownPrepare
  {
    local~lfs = require("lfs")
    local~options = \markdownLuaOptions
    if~not~lfs.isdir(options.cacheDir) then~
      assert(lfs.mkdir(options.cacheDir))
    end~
    local~md = require("markdown")
    local~convert = md.new(options)
  }
\cs_new:Npn
  \markdownConvert
  {
    local~filename = \markdownInputFilename
    local~file = assert(io.open(filename, "r"),
      [[Could~not~open~file~"]] .. filename .. [["~for~reading]])
    local~input = assert(file:read("*a"))
    assert(file:close())
    print(convert(input))
  }
\ExplSyntaxOff
\def\markdownCleanup{%
  if options.cacheDir then
    lfs.rmdir(options.cacheDir)
  end
}%
\csname newread\endcsname\markdownInputFileStream
\csname newwrite\endcsname\markdownOutputFileStream
\begingroup
  \catcode`\^^I=12%
  \gdef\markdownReadAndConvertTab{^^I}%
\endgroup
\begingroup
  \catcode`\^^M=13%
  \catcode`\^^I=13%
  \catcode`|=0%
  \catcode`\\=12%
  |catcode`@=14%
  |catcode`|%=12@
  |gdef|markdownReadAndConvert#1#2{@
    |begingroup@
    |markdownIfOption{frozenCache}{}{@
      |immediate|openout|markdownOutputFileStream@
        |markdownOptionInputTempFileName|relax@
      |markdownInfo{@
        Buffering block-level markdown input into the temporary @
        input file "|markdownOptionInputTempFileName" and scanning @
        for the closing token sequence "#1"}@
    }@
    |def|do##1{|catcode`##1=12}|dospecials@
    |catcode`| =12@
    |markdownMakeOther@
    |def|markdownReadAndConvertStripPercentSign##1{@
      |markdownIfOption{stripPercentSigns}{@
        |if##1%@
          |expandafter|expandafter|expandafter@
            |markdownReadAndConvertProcessLine@
        |else@
          |expandafter|expandafter|expandafter@
            |markdownReadAndConvertProcessLine@
            |expandafter|expandafter|expandafter##1@
        |fi@
      }{@
        |expandafter@
          |markdownReadAndConvertProcessLine@
          |expandafter##1@
      }@
    }@
    |def|markdownReadAndConvertProcessLine##1#1##2#1##3|relax{@
      |ifx|relax##3|relax@
        |markdownIfOption{frozenCache}{}{@
          |immediate|write|markdownOutputFileStream{##1}@
        }@
      |else@
        |def^^M{@
          |markdownInfo{The ending token sequence was found}@
          |markdownIfOption{frozenCache}{}{@
            |immediate|closeout|markdownOutputFileStream@
          }@
          |endgroup@
          |markdownInput{@
            |markdownOptionOutputDir@
            /|markdownOptionInputTempFileName@
          }@
          #2}@
      |fi@
      ^^M}@
    |catcode`|^^I=13@
    |def^^I{|markdownReadAndConvertTab}@
    |catcode`|^^M=13@
    |def^^M##1^^M{@
      |def^^M####1^^M{@
        |markdownReadAndConvertStripPercentSign####1#1#1|relax}@
      ^^M}@
    ^^M}@
|endgroup
\ExplSyntaxOn
\cs_new_protected:Npn
  \markdownLuaExecute
  #1
  {
    \int_compare:nNnT
      { \g_luabridge_method_int }
      =
      { \c_luabridge_method_shell_int }
      {
        \sys_if_shell_unrestricted:F
          {
            \sys_if_shell:TF
              {
                \msg_error:nn
                  { markdown }
                  { restricted-shell-access }
              }
              {
                \msg_error:nn
                  { markdown }
                  { disabled-shell-access }
              }
          }
      }
    \str_gset:NV
      \g_luabridge_output_dirname_str
      \markdownOptionOutputDir
    \luabridge_now:e
      { #1 }
  }
\cs_generate_variant:Nn
  \msg_new:nnnn
  { nnnV }
\tl_set:Nn
  \l_tmpa_tl
  {
    You~may~need~to~run~TeX~with~the~--shell-escape~or~the~
    --enable-write18~flag,~or~write~shell_escape=t~in~the~
    texmf.cnf~file.
  }
\msg_new:nnnV
  { markdown }
  { restricted-shell-access }
  { Shell~escape~is~restricted }
  \l_tmpa_tl
\msg_new:nnnV
  { markdown }
  { disabled-shell-access }
  { Shell~escape~is~disabled }
  \l_tmpa_tl
\tl_new:N
  \g__markdown_after_markinline_tl
\tl_gset:Nn
  \g__markdown_after_markinline_tl
  { \unskip }
\cs_new_protected:Npn
  \markinline
  {
    \group_begin:
    \cctab_select:N
      \c_other_cctab
    \__markdown_if_option:nF
      { frozenCache }
      {
        \immediate
          \openout
          \markdownOutputFileStream
          \markdownOptionInputTempFileName
          \relax
        \msg_info:nne
          { markdown }
          { buffering-markinline }
          { \markdownOptionInputTempFileName }
      }
    \peek_regex_replace_once:nnF
      { { (.*?) } }
      {
        \c { __markdown_if_option:nF }
          \cB { frozenCache \cE }
          \cB {
            \c { immediate }
              \c { write }
              \c { markdownOutputFileStream }
              \cB { \1 \cE }
            \c { immediate }
              \c { closeout }
              \c { markdownOutputFileStream }
          \cE }
        \c { group_end: }
        \c { group_begin: }
        \c { __markdown_setup:n }
          \cB { contentLevel = inline \cE }
        \c { markdownInput }
          \cB {
            \c { markdownOptionOutputDir } /
            \c { markdownOptionInputTempFileName }
          \cE }
        \c { group_end: }
        \c { tl_use:N }
          \c { g__markdown_after_markinline_tl }
      }
      {
        \msg_error:nn
          { markdown }
          { markinline-peek-failure }
        \group_end:
        \tl_use:N
          \g__markdown_after_markinline_tl
      }
  }
\msg_new:nnn
  { markdown }
  { buffering-markinline }
  { Buffering~inline~markdown~input~into~
    the~temporary~input~file~"#1". }
\msg_new:nnnn
  { markdown }
  { markinline-peek-failure }
  { Use~of~\iow_char:N \\ markinline~doesn't~match~its~definition }
  { The~macro~should~be~followed~by~inline~
    markdown~text~in~curly~braces }
\cs_new_protected:Npn
  \markdownInput
  #1
  {
    \__markdown_if_option:nTF
      { frozenCache }
      {
        \markdownInputRaw
          { #1 }
      }
      {
        \tl_set:Nx
          \l_tmpa_tl
          { #1 }
        \file_get_full_name:VNTF
          \l_tmpa_tl
          \l_tmpb_tl
          {
            \exp_args:NV
              \markdownInputRaw
              \l_tmpb_tl
          }
          {
            \msg_error:nnV
              { markdown }
              { markdown-file-does-not-exist }
              \l_tmpa_tl
          }
      }
  }
\msg_new:nnn
  { markdown }
  { markdown-file-does-not-exist }
  {
    Markdown~file~#1~does~not~exist
  }
\ExplSyntaxOff
\begingroup
  \catcode`|=0%
  \catcode`\\=12%
  \catcode`|&=6%
  |gdef|markdownInputRaw#1{%
    |begingroup
    |catcode`|%=12
    |catcode`|#=12
    |markdownIfOption{frozenCache}{%
      |ifnum|markdownOptionFrozenCacheCounter=0|relax
        |markdownInfo{Reading frozen cache from
          "|markdownOptionFrozenCacheFileName"}%
        |input|markdownOptionFrozenCacheFileName|relax
      |fi
      |markdownInfo{Including markdown document number
        "|the|markdownOptionFrozenCacheCounter" from frozen cache}%
      |csname markdownFrozenCache%
        |the|markdownOptionFrozenCacheCounter|endcsname
      |global|advance|markdownOptionFrozenCacheCounter by 1|relax
    }{%
      |markdownInfo{Including markdown document "&1"}%
      |openin|markdownInputFileStream{&1}%
      |closein|markdownInputFileStream
      |markdownPrepareLuaOptions
      |markdownPrepareInputFilename{&1}%
      |markdownLuaExecute{%
        |markdownPrepare
        |markdownConvert
        |markdownCleanup}%
      |markdownIfOption{finalizeCache}{%
        |global|advance|markdownOptionFrozenCacheCounter by 1|relax}{}%
    }%
    |endgroup
  }%
|endgroup
\gdef\markdownEscape#1{%
  \catcode`\%=14\relax
  \catcode`\#=6\relax
  \input #1\relax
  \catcode`\%=12\relax
  \catcode`\#=12\relax
}%
\endinput
%%
%% End of file `markdown.tex'.
