Skip to content

support nested emphasis delimiters #2086

Closed

Description

@brainchild0

Markdown processors vary in handling of nested emphasis delimiters, but most have some kind of support.

For example, consider the following text:

**a **b** c**
*a *b* c*

Some engines would render the b letters specially because of the nesting, but almost all will recognize that all the asterisk characters in this particular example are in fact delimiters. Basic handling would treat the entire first line as strong emphasis text and the entire second line as emphasis text. That is, the lines will be rendered as:

a b c
a b c

I recommend that Mark Text include such support, which it currently lacks, as seen in the below window capture.

Screenshot from 2020-04-30 09-37-09

Activity

  1. fxha commented on Jun 11, 2020

    @fxha
    Contributor

    Please go ahead and file an issue here. I think the core issue is that both *a ... c* and *b* are valid options but *a *b and b* c* aren't because there are spaces between the delimiter and the character.

  2. added
    🐸 markdown/spec
    🐟 blocked/upstream
    on Jun 11, 2020
  3. brainchild0 commented on Jun 12, 2020

    @brainchild0
    ContributorAuthor

    If Mark Text uses Marked internally, which I did not know, then I agree that the issue should be passed upstream. However, based on reviewing the issue tracker for Marked, achieving CommonMark compliance is an ongoing activity.

    I am reluctant to create or even to mention an issue in Marked, to avoid creating unwanted clutter in their system.

    However, since Mark Text is affected, perhaps we can leave open this issue to track progress.

  4. fxha commented on Jun 16, 2020

    @fxha
    Contributor

    If Mark Text uses Marked internally, which I did not know, then I agree that the issue should be passed upstream.

    Yes, we're using a customized fork of marked that is really close to upstream. Please file an issue there because this is a special case and need to be discussed whether and how it should be fixed - both CommonMark and GFM render this a bold/italic.

    See demo.

  5. reopened this on Jun 16, 2020
  6. brainchild0 commented on Jun 16, 2020

    @brainchild0
    ContributorAuthor

    both CommonMark and GFM render this a bold/italic

    In CommonMark it's double emphasis:

    $ echo '*a *b* c*' | pandoc --from commonmark 
    <p><em>a <em>b</em> c</em></p>
    $ echo '**a **b** c**' | pandoc --from commonmark 
    <p><strong>a <strong>b</strong> c</strong></p>
    

    This is described (not terribly well) in the spec.

    Here in Github it's also not bold-italic:

    Code Rendering
    *a *b* c* a b c
    **a **b** c** a b c

    The Marked group is working to gain compliance with the standards test suites. Once they do, then the issue would resolve. They already have an issue to track this progress.

  7. fxha commented on Jun 16, 2020

    @fxha
    Contributor

    Failed GFM examples:

    • 382
    • 416
    • 427
    • ...

    This might be an easy fix because _foo __bar__ baz_ is parsed correctly but _foo _bar_ baz_ not.

  8. brainchild0 commented on Jun 17, 2020

    @brainchild0
    ContributorAuthor

    Apparently upstream gifts may be coming sooner than expected.

    See markedjs/marked#1686.

  9. changed the title [-]support nested emphasis delimeters[/-] [+]support nested emphasis delimiters[/+] on Jun 19, 2020
  10. brainchild0 commented on Jul 14, 2020

    @brainchild0
    ContributorAuthor

    Improved support for nested emphasis is now available in marked. PR #2277 attempts to integrate the new version, by changing package.json but is not currently successful. I am not aware of the customized version of marked mentioned earlier.

  11. fxha commented on Jul 14, 2020

    @fxha
    Contributor

    @brainchild0 We're using a custom version of marked.js and we need to rebase our custom marked.js. The package included in the project is to test our version against the upstream one.

    Edit: As our version is behind upstream, we need to rebase all changes from the given commit in the linked readme. I think all bug fixes from marked v0.8.0 are already included in our "fork".

  12. brainchild0 commented on Jul 15, 2020

    @brainchild0
    ContributorAuthor

    @fxha: It seems that the fork is heavily restructured, into multiple files. I find no obvious way to automate the rebasing from the upstream source.

    I have no doubt that you encountered various constraints while writing the fork, but I am wondering about moving to some kind of more automatic and reliable maintenance process. Is it possible to consider including the source in a submodule, and then modifying the library through a static patch applied by a build preprocessor? Or perhaps some of the additional functionality may be gained through monkey patching? Even using simply a forked repository with Git merging may help improve maintenance in the future.

  13. added
    🐛 bug
    and removed
    🐟 blocked/upstream
    on Dec 7, 2020
  14. fxha commented on Dec 7, 2020

    @fxha
    Contributor

    This seems to be an issue with our frontend and not marked.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐸 markdown/spec🐛 bug🔭 area/muya

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions