Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GithubMarkdown not parsing inline code when there are square brackets around it #135

Closed
cornernote opened this issue Oct 31, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@cornernote
Copy link

echo (new \cebe\markdown\GithubMarkdown())->parse('[`code`]');

Expected Output:

[code]

Actual Output:

[code]

reference from:
cornernote/minetest-bower#29

@cebe
Copy link
Owner

cebe commented Oct 31, 2016

This happens because [ marks the start of a reference. If the reference is not found, it is replaced with its original text, which is printed unparsed:

return $block['orig'];

The fix should be to parse the content and render its absy as it is done when the link is created:

. '>' . $this->renderAbsy($block['text']) . '</a>';

Same issue exists for images:

return $block['orig'];

@cebe cebe added the bug label Oct 31, 2016
@cebe cebe added this to the 1.1.2 milestone Oct 31, 2016
@cebe
Copy link
Owner

cebe commented Oct 31, 2016

Here are some failing tests:

diff --git a/tests/markdown-data/code.md b/tests/markdown-data/code.md
index 1c1ba7f..6ab77b2 100644
--- a/tests/markdown-data/code.md
+++ b/tests/markdown-data/code.md
@@ -14,4 +14,10 @@ this is ``` inline `` code ```

 this is code too: ` co
 ooo
-de `
\ No newline at end of file
+de `
+
+A code block enclosed in brackets: [`somecode`].
+
+A code block enclosed in brackets: [`somecode`][].
+
+A code block enclosed in a link: [`somecode`](./url.md).

@cebe cebe modified the milestones: 1.1.2, 1.1.3 Jul 16, 2017
@cebe cebe self-assigned this Jul 16, 2017
@cebe cebe closed this as completed in d4d5858 Mar 14, 2018
@cebe
Copy link
Owner

cebe commented Mar 14, 2018

fixed, thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants