How to escape the hash tag character in Org mode (source or example)?

Hi!

I want to output the following text:

How can I mark the place for the "Read more" in Org Mode?

Like this:

# more

I want # more to be formatted either as source code or example.

If I use the following text, the hash tag is not displayed properly.

* How can I mark the place for the "Read more" in Org Mode?

Like this:

#+begin_example
# more
#+end_example

Here is what I get:

I tried to escape the hashtag character (\#, \\#, ##), but this did not work.

What can I do in order to output # more formatted as an example or source code?

Thanks in advance

When I do this…

content/foo.org

---
title: "Foo"
---

* How can I mark the place for the "Read more" in Org Mode?

Like this:

#+begin_example
# more
#+end_example

I get this:

<div id="outline-container-headline-1" class="outline-2">
  <h2 id="headline-1">
    How can I mark the place for the &#34;Read more&#34; in Org Mode?
  </h2>
  <div id="outline-text-headline-1" class="outline-text-2">
    <p>Like this:</p>
    <pre class="example"># more</pre>
  </div>
</div>

Which looks like this:

image

1 Like

In my case

Another attempt:

#+begin_example
# more
#+end_example

is rendered as

<p>
Another attempt:</p>
e>

If you have any ideas where to look for the error, please tell.

I get this:

image

Other than making sure you are using the latest Hugo version, I don’t know what to tell you without access to your project.

1 Like

If I change

#+title: Foo

to

---
title: "Foo"
---

it (the output of hashtag as example) works.

Thanks for your help.

This looks like a bug to me. You should be able to use Org Mode front matter. I’ll look into this.

See https://gohugo.io/content-management/summaries/#manual-summary-splitting.

With Org Mode, the manual summary divider is “# more”, hence the conflict you’re seeing.

The only way around this, that I know of, is to insert the summary divider before any content.

#+title: Foo

# more

#+begin_example
# more
#+end_example

This is not a bug… just known limitation of using a summary divider. You have to do the same thing in Markdown when using <!--more-->.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.