Plain Text support and syntax highlighting


I have been a faithful user of Scrivener since before it was on sale, never really had any issue with it ; I just love it. One of the features I use the most is compiling my documents to LaTeX via MultiMarkdown, which basically means that any document of mine has both Markdown and LaTeX in it, and does not really make use of the Rich Text features (I use footnotes, alright, but I can code them). Up to now, my solution to the absence of syntax highlighting has been to… highlight the code manually.

But Scrivener being the great software it is, I am sure that other users have similar needs, and that some might even consider using it as a text editor of sorts, for various projects. The idea that had me raise this question is that I would like to use Scrivener for my notes and todos, for which I rely quite heavily on syntax highlighting. Say, it would be nice to have the Markdown or LaTeX syntax highlighted for me automatically. Without becoming a code editor, I am sure Scrivener could appeal to a lot of people who grew tired of WYSIWYG and who want to make full-use of markup languages (then, adding TeX highlighting would be trivial).

This question has been raised before, by someone with similar needs:
and I perfectly understand Amber’s answer – syntax highlighting in an RTF document would be a mess and would eat up way too much memory. But then, why not provide a plain text option (running TXT files instead of RTF ones) at the project level or within a project, and allow syntax highlighting for these. The highlighters could be developed independently as plugins using regular expressions and cascading styles (as is done in the Espresso application, for instance). Would this be feasible in Scrivener?

Of course, I would understand if this feature request is beyond the scope of the Scrivener project, but since the question has not been raised in a while, and not under the plain text approach, I thought it might be worthwhile to ask again.

Many thanks for considering my question, and many more thanks for making such a great piece of software,

The problem with having a toggle to use plain-text source files instead of RTF source files is that Scrivener features hinge upon the source format being RTF, and the editor session in general being rich text. There are features that would have to be simply disabled completely in a plain-text project. Footnotes, comments, cross-document linking and revisions would be the main things. And meanwhile that option doesn’t really given you any benefit. There is no end-user difference between typing in a text field with rich text controls and a text field with none. This switch would purely be for the sake of being able to run some syntax highlighting code over the contents of the editor. In effect, there would need to be a toggle in the application somewhere that asks you to switch off X features to use Y feature, and switch off Y to go back to being able to use X, and that’s just too messy for interface.

I’ve thought a lot about this problem and really the best advice I can give you is to get something easy to use like QuickCursor, and strap Scrivener’s text buffer onto another text editor. If you’re willing to give up the rich text features for a plain-text capable editor, then that solution is just as good as something built into the application, in my opinion.

Thank you for your answer; I understand that the switch would be disconcerting for some users and would clutter the interface.

It is not the relatively minor hassle of switching editors that had me add this request, but the love and joy of using Scrivener as often as possible :slight_smile: So, I’ll keep to a dedicated editor for these things, no problem.

Yeah, it’s one of those things where it would be nice if it could be made to work. I know people that use the software to compose their HTML files and all sorts of things. It would be nice. It’s just too bad the different technologies clash.

I’ve always loved Scrivener but I think the lack of plain text editor support is a weakness, especially if a user writes Markdown documents. RTF editor is very boring when I write Markdown tables and indentations and it makes me think what I get and not what I write.

I don’t think a so important switch would make a interface too messy.
I’m giving up to use Scrivener when I choose to edit some files with markdown or I need to not think what I get.

Switch different app to accomplish a simple action… that is being too messy :slight_smile:

I hope you could consider to make it possibile :wink:

I’m afraid I disagree. I find the ability to compose plain-text documents in a rich text environment to be incredibly useful and liberating, and if anything one of the great strengths of Scrivener. No other software package to my knowledge allows that freedom with a comprehensively scripted plain-text workflow attached to it. There are plenty of programs that do one or the other. There are all sorts of things I can do to my text to help me out in my work, that would be 100% impossible in a plain-text view. I like how I can visually embellish sections to make them easier on the eye if need be, or draw attention to text with highlights and font changes. I also like being able to contextually link my documents together in a tight network so that I can freely navigate topically and in disregard of the outline logic. But, that is just my opinion of course. The main problem is that it is not technically feasible to change the software to work this way at this point in time. Like I said, it’s not a matter of wanting it, or thinking it might be useful, it’s a matter of it not being possible without gutting the software.

Ideal to me would be Ulysses editor with all Scrivener wonderful functions.
Maybe somebody will create it, who knows :slight_smile:

Anyway I don’t understand why the text goes on two lines after five or six tabs.

The Ulysses editor is nice, I’ll grant you that. Can’t say I liked having to set up syntax, formatting and output in three different places whenever I wanted to do something different, though.

You’ve probably run out of tab stops. Hit Cmd-R to check the ruler.

For what it’s worth, for the tasks I need to achieve with a scrivener-esque app, syntax highlighting far outweighs any other benefits RTF may bring.

If implementing a plain-text + highlight mode cuts too far against the grain of Scrivener’s internal workings, I suggest as-you-type RTF syntax formatting as per smart quotes etc.

I’d happily throw that against the multiple cores and gigs of RAM of my not even current generation laptop. It’s 2014!

The problem isn’t performance, but that there is no way to make text look like something in the text engine, without it actually being that something. We can’t make it bold without it being bold. That would be, in my opinion, a very messy solution. I don’t believe I’ve ever seen a rich text editor with syntax highlighting. If you really, really need it, then I suggest editing your pieces of text in another editor and copy/pasting them back into Scrivener when you’re done. I do this sometimes with sections that would benefit from a programmable text editor like Sublime Edit, but I tend not to because I rely a lot on the rich text based features of the software, like links and annotations, highlights and revision tracking. I wouldn’t trade the power I get from those things for a little purely aesthetic embellishment of the syntax that I can already see just fine with my eye as symbols. I’m afraid we’ll just have to disagree on that point. :slight_smile:

Wanted to add my support for this feature. I’m working a bit in Scrivener, a lot in Markdown, across various projects.

I guess what would be ideal for me is to be able to see Markdown syntax highlighted in Scrivener so I can make sure I’ve got it right, without losing, say, the ability to add comments and see them in another pane rather than in the middle of my MS, as I do when I’m working with HTML comments in Markdown.

Don’t want to get into a war about what’s possible or not possible—just to give my +1 to Ienissei’s request, especially if it ever becomes possible.

I think what you want can be accomplished by Marked and Marked2 while you are working on your Scrivener project

I have been using Scrivener since version 1. I am a PhD student and I write in Markdown most of the time. I love Scrivener but I also appreciate the simplicity and nice Markdown support in Ulysses. So I come out with a workaround. In Scrivener, I set up a synchronization folder to, say, Dropbox. Then, in Ulysses, I import that folder as an External folder. In this way, I can take advantage of Ulysses’s markdown support and “Scrivening”-like feature to write long documents. Once I finish editing, I synced the documents back to Scrivener. Scrivener automatically takes snapshots for every sync, so I have a complete editing history as well.

It’s not perfect, but it works quite well at least for people like me who are looking for Markdown support from Scrivener. The drawback is that it’s costly. You will need to buy two apps. In addition, Ulysses’s markdown support for external files is not comprehensive either. It does not support LaTex highlighting for sure. But at least it has a quite modern markdown editing environment.

I write an article about the integration of Scrivener and Ulysses. It’s in Chinese, but I hope the screenshots explaining themselves well enough.

I’d like to +1 my support for this as well. I would love to see a per-document mode that allows for individual documents to be in plain-text with Markdown formatting.

My (and many other writers’) basic habit has now become to write in Markdown. Scrivener forcing us into rich-text means we slowly have to abandon Scrivener for other tools.

As tools, devices and publishing systems are proliferating, Markdown (and related workflows like Fountain) are becoming a standard way to write across many different platforms. It’s become the lingua franca of formatting, and Scrivener is becoming less and less useful because of its lack of support of this movement.

Which is too bad… I’ve been a Scrivener user since the beginning.

I disagree with this. Markdown got a bit more popular because mobile devices didn’t support rich text editing - which has now changed. The vast majority of writers do not use Markdown and much prefer rich text - which is why Word and its ilk are still the industry standards and we aren’t seeing them being driven out by plain text editors. Markdown is still very much a niche, and I doubt that is ever going to change given that it was invented in the first place to work around systems that did not have formatting available (it has its roots back in how we used to write emails in the 90s, before we could include italics etc). It naturally saw a resurgence as users started to use devices that, for a while, couldn’t support rich text, just as programs of the 90s couldn’t.

Markdown is very far from being the lingua franca of formatting: rich text is still very much that. It might be the lingua franca within some circles, and I know some writers love it, but there have always been some writers who prefer plain text and Markdown, ever since we began, ten years ago.

Moreover, nothing in Scrivener prevents you using Markdown, unless you absolutely need syntax highlighting- in that case, Scrivener is definitely not the program for you, and never claimed to be.

I’m not sure who this “we” is that you invoke, by the way - based on our month-on-month increase in users, and how we are selling now more than ever before, it certainly doesn’t seem to be a trend, fortunately for us. :slight_smile:

Just to be clear, though: there are no plans for a plain text mode or for syntax highlight in Scrivener. There are some wonderful programs that do that sort of thing, but it was never something Scrivener was built for, nor is it something I would want it to do, as it has always been built from the ground up as a rich text application.

I happily use multimarkdown in Scrivener, it fully supports writing in MMD if you so want (just without syntax highlighting, which isn’t a huge issue, I also use MMD Composer (which syntax highlights etc) as well which has deep markdown support for writing but really I don’t miss this at all. So much so that I’ve never even tried to work out how to open scrivener text in an external editor.

I do admit I’d personally rather Scrivener used plain text as I never use the RTF functionality (I would not miss it if Keith suddenly went all plaintext on us), but Scrivener doesn’t impede my use of MMD, and the UI is so flexible I don’t feel RTF “clutters” my experience.