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

Markdown marked as code is rendered #54

Closed
malberts opened this issue Oct 30, 2023 · 4 comments · Fixed by #55
Closed

Markdown marked as code is rendered #54

malberts opened this issue Oct 30, 2023 · 4 comments · Fixed by #55
Assignees
Labels
bug Something isn't working

Comments

@malberts
Copy link
Contributor

Follow-up to #53 and #42

In LocalSettings, set:
$wgExternalContentRenderMarkdownByDefault = true;
(or remove the line to use the default true).

Use this wikitext in a page:
{{#embed:https://github.com/ProfessionalWiki/ExternalContent|lang=md}}

The Markdown is now rendered, but it should be in a code block:
Screenshot_20231030_134331

@malberts malberts added the bug Something isn't working label Oct 30, 2023
@malberts
Copy link
Contributor Author

Additionally, even non-Markdown URLs get rendered as Markdown.

Example with the same config as above:

{{#embed:https://github.com/ProfessionalWiki/ExternalContent/blob/master/src/Adapters/EmbedPresenter/UsageTracker.php}}

{{#embed:https://github.com/ProfessionalWiki/ExternalContent/blob/master/src/Adapters/EmbedPresenter/UsageTracker.php|lang=php}}

Screenshot_20231030_134552

@myousuffazal
Copy link
Contributor

For my clarity, please clarify:

From what I understood from #37
If $wgExternalContentRenderMarkdownByDefault === true then all files will be rendered as Markdown by default
If $wgExternalContentRenderMarkdownByDefault === false then all files will be rendered as Code by default, unless render parameter is defined

Now, what I've missed is if the lang parameter is defined, it should render as code regardless.

Am I correct?

@malberts
Copy link
Contributor Author

malberts commented Oct 30, 2023

If $wgExternalContentRenderMarkdownByDefault === true then all files will be rendered as Markdown by default

Only if it is a Markdown file. It doesn't make sense to render non-Markdown files.
The intention with this config is to maintain backward compatibility with version 1.x where only Markdown was originally supported and therefore it was the default.

If $wgExternalContentRenderMarkdownByDefault === false then all files will be rendered as Code by default, unless render parameter is defined

Yes.

Now, what I've missed is if the lang parameter is defined, it should render as code regardless.

Yes.

@myousuffazal
Copy link
Contributor

Fixed in #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants