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

Django templating syntax throws errors when publishing an article. #208

Open
Dee-McG opened this issue Mar 25, 2023 · 2 comments
Open

Django templating syntax throws errors when publishing an article. #208

Dee-McG opened this issue Mar 25, 2023 · 2 comments

Comments

@Dee-McG
Copy link

Dee-McG commented Mar 25, 2023

Context

When trying to use a code block containing django templating syntax, publishing the article throws an error.

Expected Behavior

Articles can be published with django templating code blocks

Current Behavior

When submitting, error messages are shown and the article does not publish.

Screenshots

image

Steps to reproduce

Please provide detailed steps for reproducing the issue

  1. Create an article
  2. Add a code block with django templating syntax:
{ % if request.user == recipe.owner % }
<div class="text-center">
     <a href="{% url 'edit_recipe' recipe.id %}" class="btn btn-primary w-25">Edit</a>
     <a href="{% url 'delete_recipe' recipe.id %}" class="btn btn-primary w-25">Delete</a>
</div>
{ % endblock % }
  1. Submit article

Additional info

You can escape this in the UI with {% markdoc-example %} {% /markdoc-example %} but it still won't publish.

@NiallJoeMaher
Copy link
Contributor

This will be fixed with the new editor I hope, it's a long time coming 🙈

@pkspyder007
Copy link
Collaborator

pkspyder007 commented Oct 22, 2023

@Dee-McG Sorry for late response but you can wrap your code block with a markdoc-example block to render it without breaking.
Here is a small example

{% markdoc-example %}
<YOUR CODE BLOCK>
{% /markdoc-example %}
image

Let me know if this works for your usecase we'll try to address this issue soon as Niall mentioned.

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

No branches or pull requests

3 participants