Skip to content

ManyFormats is a library you can use to generate text using predefined or custom formatting options

License

Notifications You must be signed in to change notification settings

SpikeHimself/ManyFormats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ManyFormats

ManyFormats provides functionality to format text using predefined or custom formats.

I maintain a project which has documentation in Markdown formatting as well as BBCode formatting. I got fed up with updating two otherwise equal files all the time, so I figured out a way to keep the text in one place.

To achieve this I created this project, ManyFormats, and use T4 Text Templates to keep all the text centralised.

Let me quickly show you how it works

Given the following example file document-template.txt:

<#= mf.Heading("This is a header") #>

<#= mf.Link("Open an issue!", "https://github.com/SpikeHimself/ManyFormats/issues") #>

I can maintain my documentation using the following T4 setup, for Markdown:

<#@ output extension=".md" #>
<# var mf = new Markdown(); #>
<#@ include file="document-template.txt" once="true" #>

And like so, for BBCode:

<#@ output extension=".bbcode" #>
<# var mf = new Bbcode(); #>
<#@ include file="document-template.txt" once="true" #>

And the outputs would be, respectively:

output.md

# This is a header

[Open an issue!](https://github.com/SpikeHimself/ManyFormats/issues)

output.bbcode

[size=6]This is a header[/size]

[url=https://github.com/SpikeHimself/ManyFormats/issues]Open an issue![/url]

Wow!

Documentation to follow... :)

About

ManyFormats is a library you can use to generate text using predefined or custom formatting options

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages