Skip to content

[9.x] feature: Str::inlineMarkdown() - #43126

Merged
taylorotwell merged 3 commits into
laravel:9.xfrom
danharrin:feature/inline-markdown-helpers
Jul 11, 2022
Merged

[9.x] feature: Str::inlineMarkdown()#43126
taylorotwell merged 3 commits into
laravel:9.xfrom
danharrin:feature/inline-markdown-helpers

Conversation

@danharrin

@danharrin danharrin commented Jul 11, 2022

Copy link
Copy Markdown
Contributor

Currently, Str::markdown() wraps all content in a block element <p> when converting.

For certain layouts, this is inconvenient, as the markdown needs to be rendered inline instead.

Commonmark has a built-in InlinesOnly extension that we can use in a Str::inlineMarkdown() method.

Additionally, I've added an inlineMarkdown() method to the fluent Stringable object to maintain consistency.

Str::markdown('Use [Laravel](https://laravel.com)!') // <p>Use <a href="https://laravel.com">Laravel</a>!</p>

Str::inlineMarkdown('Use [Laravel](https://laravel.com)!') // Use <a href="https://laravel.com">Laravel</a>!

@danharrin danharrin changed the title feature: Inline markdown helpers [9.x] feature: Inline markdown helpers Jul 11, 2022
@danharrin danharrin changed the title [9.x] feature: Inline markdown helpers [9.x] feature: Str::inlineMarkdown() Jul 11, 2022
@taylorotwell
taylorotwell merged commit 8301bcd into laravel:9.x Jul 11, 2022
@danharrin

Copy link
Copy Markdown
Contributor Author

@taylorotwell do you want a docs PR for this? or are you on it already

@danharrin
danharrin deleted the feature/inline-markdown-helpers branch July 11, 2022 13:00
@driesvints

Copy link
Copy Markdown
Member

@danharrin feel free to send in a PR to the docs 👍

@danharrin

Copy link
Copy Markdown
Contributor Author

laravel/docs#8039

@driesvints

Copy link
Copy Markdown
Member

@danharrin thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants