Renamed link attribute extensions.
* Old `link_attributes` -> `mmd_link_attributes` * Recently added `common_link_attributes` -> `link_attributes` Note: this change could break some existing workflows.
This commit is contained in:
parent
244cd5644b
commit
73e2d7976c
4 changed files with 15 additions and 15 deletions
10
README
10
README
|
@ -2917,7 +2917,7 @@ nonbreaking space after the image:
|
|||
|
||||
\
|
||||
|
||||
#### Extension: `common_link_attributes` ####
|
||||
#### Extension: `link_attributes` ####
|
||||
|
||||
Attributes can be set on links and images:
|
||||
|
||||
|
@ -3270,11 +3270,11 @@ Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
|
|||
Accents are stripped off of accented latin letters, and non-latin
|
||||
letters are omitted.
|
||||
|
||||
#### Extension: `link_attributes` ####
|
||||
#### Extension: `mmd_link_attributes` ####
|
||||
|
||||
Parses multimarkdown style key-value attributes on link
|
||||
and image references. This extension should not be confused with the
|
||||
[`common_link_attributes`](#extension-common_link_attributes) extension.
|
||||
[`link_attributes`](#extension-link_attributes) extension.
|
||||
|
||||
This is a reference ![image][ref] with multimarkdown attributes.
|
||||
|
||||
|
@ -3322,7 +3322,7 @@ variants are supported:
|
|||
`markdown_phpextra` (PHP Markdown Extra)
|
||||
: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
|
||||
`fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
|
||||
`header_attributes`, `common_link_attributes`, `abbreviations`,
|
||||
`header_attributes`, `link_attributes`, `abbreviations`,
|
||||
`shortcut_reference_links`.
|
||||
|
||||
`markdown_github` (GitHub-Flavored Markdown)
|
||||
|
@ -3333,7 +3333,7 @@ variants are supported:
|
|||
`shortcut_reference_links`.
|
||||
|
||||
`markdown_mmd` (MultiMarkdown)
|
||||
: `pipe_tables` `raw_html`, `markdown_attribute`, `link_attributes`,
|
||||
: `pipe_tables` `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
|
||||
`raw_tex`, `tex_math_double_backslash`, `intraword_underscores`,
|
||||
`mmd_title_block`, `footnotes`, `definition_lists`,
|
||||
`all_symbols_escapable`, `implicit_header_references`,
|
||||
|
|
|
@ -86,8 +86,8 @@ data Extension =
|
|||
| Ext_markdown_attribute -- ^ Interpret text inside HTML as markdown
|
||||
-- iff container has attribute 'markdown'
|
||||
| Ext_escaped_line_breaks -- ^ Treat a backslash at EOL as linebreak
|
||||
| Ext_common_link_attributes -- ^ link and image attributes
|
||||
| Ext_link_attributes -- ^ MMD style reference link attributes
|
||||
| Ext_link_attributes -- ^ link and image attributes
|
||||
| Ext_mmd_link_attributes -- ^ MMD style reference link attributes
|
||||
| Ext_autolink_bare_uris -- ^ Make all absolute URIs into links
|
||||
| Ext_fancy_lists -- ^ Enable fancy list numbers and delimiters
|
||||
| Ext_lists_without_preceding_blankline -- ^ Allow lists without preceding blank
|
||||
|
@ -156,7 +156,7 @@ pandocExtensions = Set.fromList
|
|||
, Ext_subscript
|
||||
, Ext_auto_identifiers
|
||||
, Ext_header_attributes
|
||||
, Ext_common_link_attributes
|
||||
, Ext_link_attributes
|
||||
, Ext_implicit_header_references
|
||||
, Ext_line_blocks
|
||||
, Ext_shortcut_reference_links
|
||||
|
@ -190,7 +190,7 @@ phpMarkdownExtraExtensions = Set.fromList
|
|||
, Ext_definition_lists
|
||||
, Ext_intraword_underscores
|
||||
, Ext_header_attributes
|
||||
, Ext_common_link_attributes
|
||||
, Ext_link_attributes
|
||||
, Ext_abbreviations
|
||||
, Ext_shortcut_reference_links
|
||||
]
|
||||
|
@ -218,7 +218,7 @@ multimarkdownExtensions = Set.fromList
|
|||
[ Ext_pipe_tables
|
||||
, Ext_raw_html
|
||||
, Ext_markdown_attribute
|
||||
, Ext_link_attributes
|
||||
, Ext_mmd_link_attributes
|
||||
, Ext_raw_tex
|
||||
, Ext_tex_math_double_backslash
|
||||
, Ext_intraword_underscores
|
||||
|
|
|
@ -368,15 +368,15 @@ referenceKey = try $ do
|
|||
let sourceURL = liftM unwords $ many $ try $ do
|
||||
skipMany spaceChar
|
||||
notFollowedBy' referenceTitle
|
||||
notFollowedBy' $ guardEnabled Ext_common_link_attributes >> attributes
|
||||
notFollowedBy' $ guardEnabled Ext_link_attributes >> attributes
|
||||
notFollowedBy' (() <$ reference)
|
||||
many1 $ notFollowedBy space >> litChar
|
||||
let betweenAngles = try $ char '<' >> manyTill litChar (char '>')
|
||||
src <- try betweenAngles <|> sourceURL
|
||||
tit <- option "" referenceTitle
|
||||
attr <- option nullAttr $ try $
|
||||
guardEnabled Ext_common_link_attributes >> skipSpaces >> attributes
|
||||
addKvs <- option [] $ guardEnabled Ext_link_attributes
|
||||
guardEnabled Ext_link_attributes >> skipSpaces >> attributes
|
||||
addKvs <- option [] $ guardEnabled Ext_mmd_link_attributes
|
||||
>> many (try $ spnl >> keyValAttr)
|
||||
blanklines
|
||||
let attr' = extractIdClass $ foldl (\x f -> f x) attr addKvs
|
||||
|
@ -1729,7 +1729,7 @@ regLink :: (Attr -> String -> String -> Inlines -> Inlines)
|
|||
regLink constructor lab = try $ do
|
||||
(src, tit) <- source
|
||||
attr <- option nullAttr $
|
||||
guardEnabled Ext_common_link_attributes >> attributes
|
||||
guardEnabled Ext_link_attributes >> attributes
|
||||
return $ constructor attr src tit <$> lab
|
||||
|
||||
-- a link like [this][ref] or [this][] or [this]
|
||||
|
|
|
@ -287,7 +287,7 @@ attrsToMarkdown attribs = braces $ hsep [attribId, attribClasses, attribKeys]
|
|||
|
||||
linkAttributes :: WriterOptions -> Attr -> Doc
|
||||
linkAttributes opts attr =
|
||||
if isEnabled Ext_common_link_attributes opts && attr /= nullAttr
|
||||
if isEnabled Ext_link_attributes opts && attr /= nullAttr
|
||||
then attrsToMarkdown attr
|
||||
else empty
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue