aspnet / Templating

[Archived] ASP.NET Core templates for .NET CLI and Visual Studio. Project moved to https://github.com/aspnet/AspNetCore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is the markdown syntax for templating

cilerler opened this issue · comments

I have a .NET Core template and wondering how I can hide partial content from markdown file based on the flags set?

As you may see below I tried what I do in CS project files but it didn't work.

README.md

# Steps

- createSolutionFile.ps1

<!--#if (CacheSqlServer)-->
- sql-cache.ps1
    1. create database `DistributedCache`
    2. create schema `cache`
    3. run the script
<!-- #endif -->

- user-secrets.ps1

<!--#if (EntityFramework)-->
- scaffold.ps1
- migrate.ps1 
<!-- #endif -->

- build.ps1

<!--#if (WindowsService)-->
- windows-service.ps1
<!-- #endif -->
commented

Hi. It looks like this is a question about how to use ASP.NET Core. While we do our best to look through all the issues filed here, to get a faster response we suggest posting your questions to StackOverflow using the asp.net-core-mvc tag.

commented

@ryanbrandenburg can you please answer this question when you'll get time? Thanks!

Based on answer @poke provided in StackOverflow adding code below into template.json solves the issue.

"SpecialCustomOperations": {
  "**/*.md": {
    "operations": [
      {
        "type": "conditional",
        "configuration": {
            "if": ["<!--#if"],
            "else": ["<!--#else"],
            "elseif": ["<!--#elseif", "<!--#elif"],
            "endif": ["<!--#endif"],
            "trim": "true",
            "wholeLine": "true"
        }
      }
    ]
  }
}