Skip to content
This repository was archived by the owner on Apr 6, 2022. It is now read-only.
This repository was archived by the owner on Apr 6, 2022. It is now read-only.

Improve Fallback for Markdown References and Definitions in Comments #320

Description

@tpreusse

Currently we display node.identifier if someone uses [] in a way that triggers a linkReference, imageReference or definition.

Example in schema.js:

{
matchMdast: matchType('linkReference'),
props: node => ({
identifier: node.identifier,
url: node.url,
referenceType: node.referenceType
}),
component: ({ children, identifier, url, referenceType }) => {
if (referenceType === 'shortcut') {
return <span>[{identifier}]</span>
} else {
return (
<span>
{children} [{identifier}]
</span>
)
}
}
},

Here an example mdast:
https://runkit.com/5f67c1f326b183001bb387e6/5f67c1f4be0951001a02898b

Newer version of remark seem to have a new label attribute which is better. An alternative would be to convert the children to plain text.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions