Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always have a blank line at first line without doctype in pretty mode. #2443

Open
dxcqcv opened this issue Jul 6, 2016 · 3 comments
Open
Labels

Comments

@dxcqcv
Copy link

dxcqcv commented Jul 6, 2016

I use pug to write jekyll make github page, so when I used yml front matter in pug, it always compiled a blank line at first line, so code like

|---
|layout: default
|title: Shang Wen Long's blog
|---
.hello index contents

be compiled to

/******** Here is a blank line **********/

---
layout: default
title: Shang Wen Long's blog

---
<div class="hello">index contents</div>

Through my test, in pretty mode because jekyll needs yml front matter format, there is blank line at first line without doctype, but with doctype everything is OK

so the first blank line is for doctype, I guess, but in this case I wanna remote it and keep in pretty mode, and to delete blank line every time is not fun, how to do it? or to fix this glitch. help, thx~

@ForbesLindesay
Copy link
Member

We generally don't fix bugs in pretty printing mode. You can force a blank line via = '\n'. If it produces a blank first line with pretty mode disabled, that is a bug.

@TimothyGu
Copy link
Member

Yeah that's a bug I tried to fix last year but couldn't do it. If all else fails, just pug.render(...).trim().

@TimothyGu TimothyGu added the bug label Jul 25, 2016
@bashpro
Copy link

bashpro commented Aug 27, 2021

For anyone who has this issue, I was looking for a way to solve this and found that the way around it is the following:

-
|---
| title: example
| layout: '../example.(whatever extension)'
|---

At first declare the variable/pug script tag (-) at the start and this removes the first line when rendered and my front matter worked.

@ForbesLindesay @TimothyGu just thought to let you know the workaround if this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants