How does discourse format erb/html?


(Joe Dallago) #1

When developing a web application, you end up with some pretty complex markup at times. In the past, I’ve always indented markup to fit within a certain character limit(usually 120). However, recently I’ve found that some blocks of text are better just left as long uninterrupted blocks of text. I’m basically talking about the difference between:

<tr>
    <td class="panel-content">
        <div class="posted-in">
            <p class="posted-in-course">
                There ${ pluralize('was', 'were', course_data['unseen_count']) } <strong>${ course_data['unseen_count'] } posts</strong> in <a href="${ request.route_url('course', id=course.id) }">${ course.name }</a> while you were away.
             </p>
        </div>
    </td>
</tr>

And

<tr>
    <td class="panel-content">
        <div class="posted-in">
            <p class="posted-in-course">
                There ${ pluralize('was', 'were', course_data['unseen_count']) } 
                <strong>${ course_data['unseen_count'] } posts</strong> 
                in 
                <a href="${ request.route_url('course', id=course.id) }">
                    ${ course.name }
                </a> 
                while you were away.
             </p>
        </div>
    </td>
</tr>

How does the discourse community generally like to format its markup? Is there a style guide in place for this purpose? At the end of the day I just want things to be consistent, but it’s hard to develop hardcore rules when it comes to markup it seems.


(Mittineague) #2

AFAIK there are no conventions yet.

As newlines aren’t rendered unless you put in <br> tags, I’d say use whatever you personally prefer for now.


(Robin Ward) #3

I don’t care as long as it looks nice. Sometimes I’ll break up long lines, sometimes I don’t :smile:


(Joe Dallago) #4

I like that take. “As long as it looks nice.”