Module: Jekyll::WikiLinks
- Defined in:
- lib/jekyll-wikilinks/config.rb,
lib/jekyll-wikilinks/version.rb,
lib/jekyll-wikilinks/util/regex.rb,
lib/jekyll-wikilinks/util/parser.rb,
lib/jekyll-wikilinks/patch/context.rb,
lib/jekyll-wikilinks/util/wikilink.rb,
lib/jekyll-wikilinks/plugins/filter.rb,
lib/jekyll-wikilinks/util/link_index.rb,
lib/jekyll-wikilinks/patch/doc_manager.rb,
lib/jekyll-wikilinks/plugins/converter.rb,
lib/jekyll-wikilinks/plugins/generator.rb
Defined Under Namespace
Modules: TypeFilters Classes: Context, DocManager, Generator, LinkIndex, Parser, PluginConfig, WebLinkConverter, WikiLinkBlock, WikiLinkInline
Constant Summary collapse
- VERSION =
"0.0.12"
- SUPPORTED_IMG_FORMATS =
supported image formats from: docs.github.com/en/github/managing-files-in-a-repository/working-with-non-code-files/rendering-and-diffing-images
Set.new(['.png', '.jpg', '.gif', '.psd', '.svg'])
- REGEX_LINK_LEFT =
wikilink constants
/\[\[/
- REGEX_LINK_RIGHT =
/\]\]/
- REGEX_LINK_EMBED =
/(?<embed>\!)/
- REGEX_LINK_TYPE =
/\s*::\s*/
- REGEX_LINK_HEADER =
/\#/
- REGEX_LINK_BLOCK =
/\#\^/
- REGEX_LINK_LABEL =
/\|/
- REGEX_LINK_TYPE_CHARS =
wikitext usable char requirements
/[^\n\s\!\#\^\|\]]+/i
- REGEX_FILENAME_CHARS =
/[^\\:\#\^\|\[\]]+/i
- REGEX_HEADER_CHARS =
/[^\!\#\^\|\[\]]+/i
- REGEX_BLOCK_ID_CHARS =
/[^\\\/:\!\#\^\|\[\]^\n]+/i
- REGEX_LABEL_CHARS =
/(.+?)(?=\]{2}[^\]])/i
- REGEX_LINK_TYPE_TXT =
capture groups
/(?<link-type-txt>#{REGEX_LINK_TYPE_CHARS})/i
- REGEX_FILENAME =
/(?<filename>#{REGEX_FILENAME_CHARS})/i
- REGEX_HEADER_TXT =
/(?<header-txt>#{REGEX_HEADER_CHARS})/i
- REGEX_BLOCK_ID_TXT =
/(?<block-id>#{REGEX_BLOCK_ID_CHARS})/i
- REGEX_LABEL_TXT =
/(?<label-txt>#{REGEX_LABEL_CHARS})/i
- REGEX_ATX_HEADER =
target markdown text (headers, lists, and blocks) kramdown regexes atx header: github.com/gettalong/kramdown/blob/master/lib/kramdown/parser/kramdown/header.rb#L29
/^\#{1,6}[\t ]*([^ \t].*)\n/i
- REGEX_SETEXT_HEADER =
/^\s{0,3}([^ \t].*)\n[-=][-=]*[ \t\r\f\v]*\n/i
- REGEX_BULLET =
/(?<bullet>[+*-])/i
- REGEX_BLOCK =
markdown-style block-reference
/.*\s\^#{REGEX_BLOCK_ID_TXT}/i
- REGEX_WIKI_LINK_INLINES =
inline
%r{ # capture indeces (#{REGEX_LINK_EMBED})? # 0 (#{REGEX_LINK_TYPE_TXT}#{REGEX_LINK_TYPE})? # 1 #{REGEX_LINK_LEFT} #{REGEX_FILENAME} # 2 (#{REGEX_LINK_HEADER}#{REGEX_HEADER_TXT})? # 3 (#{REGEX_LINK_BLOCK}#{REGEX_BLOCK_ID_TXT})? # 4 (#{REGEX_LINK_LABEL}#{REGEX_LABEL_TXT})? # 5 #{REGEX_LINK_RIGHT} }x
- REGEX_SINGLE =
block single
/#{REGEX_LINK_LEFT}#{REGEX_FILENAME_CHARS}#{REGEX_LINK_RIGHT}/i
- REGEX_LIST_COMMA =
list (comma is responsible for catching the single case)
/((?:\s*#{REGEX_SINGLE}\s*)(?:,\s*#{REGEX_SINGLE}\s*)*)/i
- REGEX_LIST_MKDN =
/((?<=\n)\s{0,3}#{REGEX_BULLET}\s#{REGEX_SINGLE}\s*)+/i
- REGEX_BLOCK_TYPES =
process
/((?<!\n)(?:#{REGEX_LIST_COMMA})|#{REGEX_LIST_MKDN})/i
- REGEX_WIKI_LINK_BLOCKS =
/^\s{0,3}#{REGEX_LINK_TYPE_TXT}#{REGEX_LINK_TYPE}(?:\s*|\G)(?<items>#{REGEX_BLOCK_TYPES})\n/i