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

Page Navigation Menus not working with titles that contain {{ content }} #1720

Closed
tlylt opened this issue Jan 15, 2022 · 2 comments · Fixed by #1724
Closed

Page Navigation Menus not working with titles that contain {{ content }} #1720

tlylt opened this issue Jan 15, 2022 · 2 comments · Fixed by #1724

Comments

@tlylt
Copy link
Contributor

tlylt commented Jan 15, 2022

Tell us about your environment
Windows

Snippet of the tipsAndTricks.md page below:

{% set title = "Tips & Tricks" %}
<span id="title" class="d-none">{{ title }}</span>

<frontmatter>
  title: "User Guide: {{ title | safe }}"
  layout: userGuide.md
  pageNav: 5
</frontmatter>

# {{ title | safe }}

<span id="escapingCharacters">

##### :fas-lightbulb: Escaping Characters

For Markdown syntax: To display a literal character that are normally used for Markdown formatting, add a backslash (`\`) in front of the character.

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">markdown</variable>
<variable name="code">
\* item 1

* item 1 
</variable>
</span>

<small>More info: [https://www.markdownguide.org/basic-syntax#escaping-characters](https://www.markdownguide.org/basic-syntax#escaping-characters)</small>

</span>

{% raw %}

##### :fas-lightbulb: Using {% raw %}{% endraw %} to display `{{ content }}`


To display the raw variable interpolation syntax using `{% raw %}{% endraw %}`, you would also need to add
the `v-pre` attribute using markdown-it-attrs or as a html attribute.

What did you expect to happen?
I expected the page side nav to show the formatted text of ":fas-lightbulb: Using {% raw %}{% endraw %} to display {{ content }}",

What actually happened? Please include the actual, raw output.
The last part "{{ content }}" disappeared. On the console, it is being rendered as &lrm; :
image
In the console, there is an error message:
image

The bug example can be viewed at this deploy preview page

@jonahtanjz
Copy link
Contributor

Seems like this is due to Vue treating the double curly braces as text interpolation. Will probably need to process these curly braces in the _collectNavigableHeadings method and wrap them in <span v-pre>{{ content }}</span> to treat it as raw text.

@tlylt
Copy link
Contributor Author

tlylt commented Jan 18, 2022

Seems like this is due to Vue treating the double curly braces as text interpolation. Will probably need to process these curly braces in the _collectNavigableHeadings method and wrap them in <span v-pre>{{ content }}</span> to treat it as raw text.

I see, thanks for the diagnosis! Will put up a fix for this in a while:)

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

Successfully merging a pull request may close this issue.

3 participants