Replacing hashtags with a class tag.

Hi,

In my manuscript, I put hashtags to separate scenes. During compile, I’d like those hashtags to be a line that I can style with CSS. But, I don’t know how to do it. I searched for an answer, but I’m not exactly sure how to phrase the question… Sorry if this has been covered.

Here’s an example of what I mean:
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text .

<–How do I make that something else on compile? Can it be done?

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text .

Thanks!

Jonathan

Hi,

You can do this using Replacements, as follows:

  1. In the Compile panel, click on the ab→ac icon in the right header bar.

  2. Under "Replace, type as follows:

  • Hold down Option and hit return (this allows you to enter a return character in a text field).
  • Type #
  • Again hold down Option and hit return.
    Then hit return without Option to end editing.

The text field now contains return, hash, return. It will appear blank because there’s a return character at the start, so the hash is out of sight.

  1. Under “With”, repeat the same steps, but instead of typing #, type the string you want it replaced with.

Now Compile, and all should work as you want. Note that you can also do the above the Replacements area of a custom Compile format. (The above sets the replacements for the current project, whereas baking this into a Compile format would allow you to use the format and Replacements with other projects.)

Hope that helps.

All the best,
Keith

Awesome! That helps a lot. Follow up question, can I change the hash into a class I can use to modify with CSS?

Like. # —>

Something like that?

Thanks again,

Jonathan

Ah, that’s a bit tricky, because the text will be escaped for HTML and not treated as raw HTML. A better approach there would be to use blank lines between sections (or split the sections into different documents), and then to use e.g. the"Blank Line Separators" option in the “Separators” area of Compile. This allows you to replace blank lines with a separator character, and in ePub export the separator character is assigned the CSS class “separator” especially so that users can assign custom CSS.

All the best,
Keith

I’m sorry for being a pain, but I can’t get this thing to work.

All I want to do is put a little line like this ⏤ between scenes in a chapter. The way my project is set up, each document is a new chapter. In some chapters, I have multiple scenes. I feel like I should be able to get what I want using the separators, but I’m doing something wrong… Here’s my set up:

Do I need to make the “chapter” document separate from the document holding the text?

I’m sure this is the easiest thing in the world… I just can’t seem to get it to work, though.

Nevermind. I figure out a workaround. Thanks!