Markdown Styles, including "Emphasis"

User avatar
RonJeffries
Posts: 290
Joined: Sat Dec 08, 2012 6:19 pm
Platform: Mac

Mon Jun 25, 2018 1:58 am Post

I was experimenting with Scrivener Styles in my project that produces Markdown.

I applied Heading 2 to a line, then compiled. No formatting came out, as expected, because I have the general convert to markdown switch off (because it escapes any markdown that I type in manually).

Then I added ## prefix and suffix to the Style in the Compile / Style section and got the output I needed.

So I am happy and this seems to be what I "should" do, so long as I want also to be able to type plain old ## Heading ## whenever I care to. Yes?

Then for fun, I did the same with Emphasis, gave it prefixes of *. Works as expected.

Then I selected a work and typed command I. The word displays as italic but is not styled as italic. Scrivener still thinks it is "No Style".

What's up with that, please? And "should" I just assign command-I to be the shortcut for Emphasis?

Thanks!

User avatar
AmberV
Posts: 23613
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Mon Jun 25, 2018 1:24 pm Post

So I am happy and this seems to be what I “should” do, so long as I want also to be able to type plain old ## Heading ## whenever I care to. Yes?


The style is basically doing the typing for you; the ultimate result is the same as if you typed it into the editor. That implies you can also type it into the editor right alongside the use of the style, and that there is no compulsion to use either approach exclusively. In fact, you can mix both of those techniques with Section Layout heading generation as well, which in turn can output static hash levels by type or dynamic hash levels by outline structure.

I’d use the style (or section layouts) where I’m unsure of what I might really want later on. Say for example maybe I realise the stuff I marked H2 really ought to be H3. That’s an easy fix using the style/layout approach: one central modification to the Format. By typing in the hashes though, I know I’m getting a static result—which might be exactly what I want.

Then I selected a work and typed command I. The word displays as italic but is not styled as italic. Scrivener still thinks it is “No Style”.

What’s up with that, please? And “should” I just assign command-I to be the shortcut for Emphasis?


Modifying which font variant you are using is somewhat meaningless, as are most direct formatting commands. We as humans might parse italicised glyphs to mean something special, but what do we mean by it? Are they Latin phrases? Book titles? Emphasis? The software cannot know what we mean by selecting a different font table, so the answer is to use named styles, and then assign appearance to those styles to communicate with the reader what we mean by them. It might very well be that our “Latin Phrase” and “Emphasis” styles both end up looking the same to the reader—but they don’t have to, and meanwhile our writings are enriched and made more flexible by having tagged text like this.

If I were inclined to use the Emphasis style instead of asterisks, yeah I’d definitely bind it to ⌘I. I certainly have little use for raw italics themselves, so there wouldn’t be much of a downside for me.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

User avatar
RonJeffries
Posts: 290
Joined: Sat Dec 08, 2012 6:19 pm
Platform: Mac

Mon Jun 25, 2018 2:42 pm Post

Hi Ioa,

I think I'm on your page here. What surprised me was that command-I put italic in the text yet made, apparently, no semantic mark at all in there. Somehow Scrivener knows it's italic, definitely doesn't think it's "Emphasis", seems not to think it's anything at all.

If I get to using Scriv's styles more, I'll surely bind it to Emphasis. It's just odd to see something happen and have it do nothing.

But I suppose if I use the B and I up in the style bar the same happens, so it makes sense (in that sense).

This thing is bigger on the inside ...

User avatar
KB
Site Admin
Posts: 20716
Joined: Tue Jun 13, 2006 11:23 pm
Platform: Mac
Location: Truro, Cornwall
Contact:

Mon Jun 25, 2018 3:45 pm Post

Think of it like this:

1. You have direct formatting. Here you change the typeface (bold, italics, underline), line spacing and so on manually.

2. Then you have styles. A single is two things: (i) it is a piece of metadata associated with a block of text that identifies that text as being of a particular style; (ii) it is a set of instructions on which direct formatting to apply to such blocks of text.

So, when you apply the "Emphasis" style, you are applying a piece of metadata that tells Scrivener that text is an "Emphasis" block. Such blocks are italicised by default in Scrivener, but you could override that during Compile to have them, say, be bright green and bold instead of italicised.

Not everyone uses styles. Many users use only direct formatting, either because they find it simpler or don't understand styles. Scrivener doesn't force a particular usage. And besides, you wouldn't be able to create styles unless you could apply direct formatting from which to define them.

The same is true of most word processors, incidentally. Word has an "Emphasis" style that looks the same as italics, but if you only add italics to a word, it is Normal + Italic.

All the best,
Keith
"You can't waltz in here, use my toaster, and start spouting universal truths without qualification."

User avatar
AmberV
Posts: 23613
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Mon Jun 25, 2018 4:22 pm Post

Somehow Scrivener knows it’s italic, definitely doesn’t think it’s “Emphasis”, seems not to think it’s anything at all.


Yeah, that’s the roots of it showing through, what is the basic formatting toolkit provided by NSTextView. The whole Style system is built on top of that (what you get in TextEdit), as bespoke markup in the RTF file that Scrivener applies as you use it. If you crack open one of its internal RTF files in another word processor you’ll see stuff like the following:

Code: Select all

<$Scr_Ps::0># Heading Text #
<!$Scr_Ps::0>
Kurnap ik <$Scr_Cs::1>lydran kurnap brul<!$Scr_Cs::1>? Er urfa thung morvit helk srung tolaspa er urfa groum, gronk brul nix vo; ti gen sernag velar. Rintax arul flim groum ma; gen delm zorl nix arka erk? Qi su flim, gronk irpsa qi ik anu brul berot morvit; ux erc whik.


⌘I isn’t going to insert those codes. It’s a part of the core text engine that basically just plugs in the RTF \i marker along with some font table info—same as TextEdit would. So that’s why the shortcut doesn’t map automatically to a style that may or may not be defined in the project (and for that matter may not look italic; “Emphasis” can be bright red if you want). And that’s how it “knows” the text is italic without any styles in place—because underneath the style tags there is still an RTF file that is full of hard-coded formatting (even with styles in use, but our implementation aside, that’s how RTF works even if the parser is using native RTF stylesheet features; it’s a bit old fashioned in that regard). If that’s still confusing, join the club. RTF is confusing. :)

Our putting “Emphasis” into the default stylesheet is meant to be a hint for those that would like to take a more defined approach to formatting: where the Format Bar tools are merely a front end for defining how styles should look in the editor, rather than as tools for actually formatting anything directly. It was never meant to imply that at any point the Format Bar buttons would somehow automatically map to styles.

That said, I would guess most people are perfectly happy just clicking the “I” button, and don’t really care if it is mapped to anything meaningful. All that really matters is that it looks right, and so long as you never need anything but that text to look italic in all cases, then I suppose it’s a fine enough approach—not one I’d ever be inclined toward, but I get the appeal. So, whether you look at the format bar as a style format editor or as a way to format your text directly, it makes sense to have these controls readily available.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

User avatar
RonJeffries
Posts: 290
Joined: Sat Dec 08, 2012 6:19 pm
Platform: Mac

Mon Jun 25, 2018 4:29 pm Post

(and for that matter may not look italic; “Emphasis” can be bright red if you want)


Keith says Green. You folks need to get your stuff together. :D

Thanks!

User avatar
AmberV
Posts: 23613
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Ourense, Galiza
Contact:

Mon Jun 25, 2018 9:00 pm Post

We're just trying to make Christmas in July happen a week early. :lol:
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles