Below is a recent bug report and my response. Any input on either
issue would be appreciated, although, I'm mostly looking for an answer
to the question I ask on the first issue in my response:
Would we prefer emphasis inside links or links inside emphasis? In
other words, which is more likely to be used:
[_emphasised link_][1]
or
_A [link][2] inside emphasis_
Something I didn't mention is that I have no idea if moving the
emphasis patterns before link patterns would create a whole bunch of
other issues. So, this may not be doable anyway.
On Dec 6, 2007 12:16 AM, SourceForge.net <no...@so...> wrote:
> Bugs item #1844795, was opened at 2007-12-05 07:52
> Message generated for change (Comment added) made by waylanhl
> You can respond by visiting:
> https://sourceforge.net/tracker/?func=detail&atid=790198&aid=1844795&group_id=153041
>
> Please note that this message will contain a full copy of the comment thread,
> including the initial issue submission, for this request,
> not just the latest update.
> Category: Difference from Perl Version
> Group: Markdown Core
> Status: Open
> Resolution: None
> Priority: 5
> Private: No
> Submitted By: Matt Godbolt (matt-godbolt)
> Assigned to: Nobody/Anonymous (nobody)
> Summary: Escaped links and emphasised links format differently
>
> Initial Comment:
> If you format code such as:
>
> """
>
> The following paragraph should be emphasised:
>
> _A link [inside][] an emphasis._
>
> The following should be rendered as a link:
>
> A link with underscores : [\_set\_sbh\_threshold][setsbh].
>
> [inside]: http://www.google.com/ "Google"
> [setsbh]: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__set_sbh_threshold.asp "Set Small Object Threshold"
>
> """
>
> (NB I have "SMART_EMPHASIS = 0")
>
> The emphasised link line comes out non-emphasised, with the leading and trailing underscores unstripped.
>
> The escaped link fails to be "linked" and comes out exactly as-is.
>
> The Perl version doesn't suffer from this issue, and formats the two lines as you'd expecte: a line with emphasis and a link inside it; and a linked underscored line.
>
> ----------------------------------------------------------------------
>
> >Comment By: waylan (waylanhl)
> Date: 2007-12-06 00:16
>
> Message:
> Logged In: YES
> user_id=1524916
> Originator: NO
>
> Thanks for the report. These are two unrelated issues - sort of.
>
> The 'link in emphasis' issue, is a simple fix - change the order of the
> InlinePatterns so that emphasis is run before links, but then we lose the
> ability to have emphasis inside links. It's a trade-off, we get one or the
> other and I'm not sure which is more desirable.
>
> The escaping issue is a little more complex (and also is the reason the
> recent addition of recursion in the inlinePatterns doesn't address the
> first issue). The ESCAPE_PATTERN is the first pattern run, which removes
> the backslash and inserts the character immediately following (the
> underscore in this case) into the dom as a TextNode. The problem is that
> the link is now spread across multiple nodes and there is no way to run a
> pattern against it. As markdown.pl doesn't use a dom, this is a non-issue
> for it. To add insult to injury, prior to adding recursion to
> inlinePatterns, there would have been no need to escape that link and
> things would have worked fine. The emphasis pattern would have never been
> run against that text. However, it would have still failed if escaped.
>
> Perhaps escaping needs to be addressed in a completely different manner.
>
> Although that doesn't address the first issue. The extreme solution would
> be to drop/alter the use of the dom, but that would be a **major** and
> very unlikely change - at least in the foreseeable future.
>
> I'll take this to the list for input.
>
>
>
> ----------------------------------------------------------------------
>
> You can respond by visiting:
> https://sourceforge.net/tracker/?func=detail&atid=790198&aid=1844795&group_id=153041
>
--
----
Waylan Limberg
wa...@gm...
|