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

Fix formatting for Markdown files containing {{ #48

Merged
merged 1 commit into from
Oct 6, 2016

Conversation

benizi
Copy link

@benizi benizi commented Oct 5, 2016

They're usually examples of Go-style text templates. But, Liquid templating is treating them as variable substitutions. E.g., in engine/reference/commandline/ps.md:

$ docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}"

is rendered as:

$ docker ps --filter volume=remote-volume --format "table \t"

Solution is to wrap entire files in {% raw %} ... {% endraw %} blocks.

They're usually examples of Go-style text templates.  But, Liquid templating is treating them as variable substitutions.  E.g., in `engine/reference/commandline/ps.md`:

```bash
$ docker ps --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}"
```

is rendered as:

```bash
$ docker ps --filter volume=remote-volume --format "table \t"
```

Solution is to wrap entire files in `{% raw %} ... {% endraw %}` blocks.
@benizi
Copy link
Author

benizi commented Oct 5, 2016

I think this fixes #44.

Not sure whether the (much-)simpler option of changing {{ content }} to {{ content | markdownify }} in _layouts/docs.html would work, since there are some Markdown files that contain legitimate usage of templating directives.

@johndmulhausen
Copy link

johndmulhausen commented Oct 5, 2016

I'd prefer that we put {% raw %} and {% endraw %} around every instance of a {{ bracketed }} string, like so:

{% raw %}{{ foobar }}{% endraw %}

Or at least, just the affected code blocks. The scope should be narrower, is what I mean.

If you wrap raw/endraw around the entire page like this, that will prevent any Liquid templating language from processing. So if anyone touches these 35 pages in the future and tries to include a file, add some logic, print a variable, etc., they're going to see the raw code instead of the interpreted/processed code.

@iBobik
Copy link

iBobik commented Oct 6, 2016

Not sure whether the (much-)simpler option of changing {{ content }} to {{ content | markdownify }} in _layouts/docs.html would work, since there are some Markdown files that contain legitimate usage of templating directives.

This if very nice solution, because docs contributors should not need to thing about Jekyll. How about to improve it by adding condition to _layouts/docs.html to turn on Luquid optionally?

Like this:

{% if page.use_liquid %}
  {{ content }}
{% else %}
  {{ content | markdownify }}
{% endif %}

And in all content files where Liquid is needed just include this on top:

---
use_liquid: True
---

@johndmulhausen
Copy link

@benizi @iBobik

Tried the markdownify at the layout level; that doesn't work, and it; also SUBSTANTIALLY increases build time. Accepting this fix for now; we'll adjust the scope of the RAW tags in the future if we have problems w/liquid.

@johndmulhausen johndmulhausen merged commit cb3f6f0 into docker:master Oct 6, 2016
benizi pushed a commit to benizi/docker.github.io that referenced this pull request Oct 7, 2016
Reverts commit b3a6208 in order to
replace it with more-targeted blocks.
@benizi benizi deleted the fix/raw-variables branch October 7, 2016 05:01
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.

None yet

3 participants