Text margins for Markdown Writing?


Hi there,

I use Markdown and Pandoc for my academic writing, so I need an editor for writing long, extensive text. There are a couple of nice packages to support academic writing in Atom already, but the one thing I couldn’t find yet - and which for me is not optional for writing longer documents - is a way to center the text, like in the MarkdownEditing plugin for Sublime Text 3. Is there a way to do this? Thanks!


There’s no support directly for centering text in either Markdown or GitHub-Flavored Markdown, but you can put in most HTML into standard Markdown and it will go through, unconverted, to the finished document. So you can use the HTML <center> tag like so:

## <center>Centered H2</center>


<center>Some centered body text</center>


Sorry, now I realize that my question was rather misleading. What I meant was to center the text in the editor, i.e. I would like to have margins on the left and right so the text doesn’t stretch out over the whole screen.


Have you tried the zen package?


Atom can definitely use some better markdown packages.
I’ve transitioned everything except markdown from Sublime Text to Atom.


Thanks for pointing out the zen package, but it is for distraction free writing. I would like a solution that I don’t need to activate via a shortcut first and, more important, one that doesn’t hide the open tabs.


Either use a theme that does so (pen-paper-coffee for example does add a bigger margin when writing markdown) or edit your stylesheet and add your preferred margins.

    atom-text-editor[data-grammar="source gfm"]::shadow .gutter {

You can open the user stylesheet by clicking: Edit -> Open Your Stylesheet


Thanks! Using this together with activating Soft Wrap At Preferred Line Length and playing around with different values did the trick. That said, I hope there will be an easier way to center the text in the future.


So, you would like to have the code centered like in Zen mode, but activated by default for markdown and without hiding tabs and treeview?

Let me know if that’s what you’re looking for. It sounds super nice to me as well and I bet I can add this to Zen.


Yes, that would be great!..also because the solution described above is not optimal - as soon as you resize the Atom window, the text is off again


I don’t know the first thing about pandoc. Would it make sense there as well?


Pandoc is both a document converter (e.g. it can convert from Markdown to docx) and a Markdown extension that adds syntax for academic citations, footnotes and so forth. So yes, it would make sense because you write your text just as you would write other Markdown documents with some additional syntax :slight_smile:


Check it out:


braver, I would like you to let you know that you are an awesome person :smiley: Thanks, this is exactly what I was looking for!

Only minor issues: I also use the minimap package and I think the text is bit more to the left or right with it (depending on which side you put the minimap). Would be great if it could be ignored for centering the text. Also I would like the scrollbar to be at the right edge of the Atom window, not directly next to the text. But as I said, minor issues, thank you for your work!


Sure, no problem. I do a lot of writing in Atom and this is just a great idea and helps me too. It was like no more than 15 minutes of actual coding (Atom is awesome like that).

Anyway, any improvements you can think of let me know.

I also use the minimap package and I think the text is bit more to the left or right with it

I haven’t looked at that but something should be possible.

Also I would like the scrollbar to be at the right edge of the Atom window, not directly next to the text.

I have that same problem with Zen, not sure what can be done.


I just pushed a patch that hides the scrollbar unless you hover over the editor, which kinda visually mitigates that point.
The minimap thing is riddled with downsides. You could try adding this to your personal stylesheet:

[data-grammar="source gfm"]::shadow {
  .editor--private {
    z-index: 0;
  atom-text-editor-minimap {
    position: absolute;
    right: 0;
    z-index: 1;

I might add it as an option or something… not sure yet.


Thanks, this already works quite well for me!