© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•11mo ago•
3 replies
VoidPointer

Too Much Indentation When Rendering a Scriban Template

YI have this little Scriban template for generating a simple C# class:
using Cassandra.Mapping.Attributes;

namespace {{model.name_space}};

public class {{model.Name}}
{
    {{ for prop in model.properties }}
    {{ if model.is_partition_key }}[PartitionKey]{{ end }}
    {{prop.access}} {{prop.type_name}} {{prop.name}} { get; set; }
    {{ end }}
}
using Cassandra.Mapping.Attributes;

namespace {{model.name_space}};

public class {{model.Name}}
{
    {{ for prop in model.properties }}
    {{ if model.is_partition_key }}[PartitionKey]{{ end }}
    {{prop.access}} {{prop.type_name}} {{prop.name}} { get; set; }
    {{ end }}
}

You can see the indentation for property declarations is 4 spaces, yet when I render the template, I get this:
using Cassandra.Mapping.Attributes;

namespace kyc_registration_msisdn_lookup;

public class 
{
    
        
        public int hanis_image_status { get; set; }
        
        
        public string identifier { get; set; }
        
        
        public string identity_number { get; set; }
        
        
        public Guid kyc_id { get; set; }
        
        
        public DateTime modified_datetime { get; set; }
        
        
        public string organization_code { get; set; }
        
}
using Cassandra.Mapping.Attributes;

namespace kyc_registration_msisdn_lookup;

public class 
{
    
        
        public int hanis_image_status { get; set; }
        
        
        public string identifier { get; set; }
        
        
        public string identity_number { get; set; }
        
        
        public Guid kyc_id { get; set; }
        
        
        public DateTime modified_datetime { get; set; }
        
        
        public string organization_code { get; set; }
        
}

where we have an indent of 8 spaces for the properties, and extra empty lines between the properties. What can I do to set the indentation or formatting for this template?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

indentation
C#CC# / help
3y ago
❔ Rendering Jinja template in C sharp
C#CC# / help
4y ago
HTML Templating Scriban / Razor / Stubble / Fluid etc
C#CC# / help
9mo ago