<commit_before>title: Editing Content
-
content:

Content Editing           {#content-editing}
===============

Within the _/content_ directory, there is a file named _\_shared.txt_.

If you open it up with a text editor, you should see:
<pre>
name: <em>Name</em>
&#45;
profession: <em>Graphic Designer</em>
&#45;
email: <em><EMAIL></em>
</pre>

Replace the highlighted data with your own details.

### Text file encoding    {#text-file-encoding}

All of your .txt files should be encoded using UTF-8. In addition to ensuring no strange characters are inserted which could break stacey’s rendering engine, this will also allow you to use special characters such as _&ouml;_, _&mdash;_ or double-byte characters such as _照_ or _ラ_.

Any decent text editor will give you the options to edit and save your text files as UTF-8, so google should be able to provide answers on how to do this with your editor of choice.

You can read more about [text files][] & [UTF-8 encoding][] on Wikipedia.



### Editing content       {#editing-content}
Each folder which is to be displayed as a page should have a _.txt_ file inside it (even if this text file is empty). The name of the .txt file should match up with a file in the _/templates_ folder, as this is how you select which template to use for each page.
![Screenshot of /content folder with 'project.txt' selected](/images/projects-contents-file.png)
![Screenshot of /templates folder with 'project.html' selected](/images/template-selected.png)

### How variables are created:  {#how-variables-are-created}
<ol>
	<li>Browser hits <em>http://yourdomain.com/about/</em>.</li>
	<li>
		<p>Stacey reads the appropriate content file <em>/content/3.about/content.txt</em>.</p>
<pre>
title: About Title
&#45;
content: Lorem ipsum.
</pre>
	</li>
	<li>Two variables are extracted from the keys & values from within the .txt file: <em>&#64;title</em> & <em>&#64;content</em>. These will be available for use within the templates.</li>
	<li>Stacey finds the matching template file, in this case, <em>/templates/content.html</em></li>
	<li>
		<p>Stacey replaces the variables in the template and outputs the final html.</p>
		<p>So this template code:</p>
<pre>
&lt;div id=&quot;main&quot;&gt;
&lt;h1&gt;<em>&#64;title</em>&lt;/h1&gt;
&lt;p&gt;<em>&#64;content</em>&lt;/p&gt;
&lt;/div&gt;
</pre>
	<p>becomes this html:</p>
<pre>
&lt;div id=&quot;main&quot;&gt;
&lt;h1&gt;<em>About Title</em>&lt;/h1&gt;
&lt;p&gt;<em>Lorem ipsum.</em>&lt;/p&gt;
&lt;/div&gt;
</pre>
	</li>
</ol>

### Content file format      {#content-file-format}

The content files all follow a standard format; each _key_ is followed by a _:_, a _value_ and a hyphen (&#45;) to close the value. 
<pre>
<em>key</em>: <em>value 
&#45;</em>
</pre>

The keys match up with variable markers in the template files which get replaced with the contents of the _value_. You can create as many of your own keys as you need.

#### Keys {#keys}

A key may only contain the following characters:  
~~~~~~~~~~~~~~~~~
abcdefghijklmnopqrstuvwxyz
0123456789
_
~~~~~~~~~~~~~~~~~

Essentially, lowercase latin alphanumeric characters and underscores.  
Or, for the more technically inclined, anything which can be matched by the following regular expression: _`/[a-z0-9_]+?:/`_

A standard content file looks something like this:
<pre>
title: The Test Project 1
&#45;
date: 2009, Jun—
&#45;
content: 
Lorem ipsum dolor...

</pre>

#### Separating Keys/values {#separating-keys-values}

Each value should be followed by a blank line containing only a hyphen character. The hyphen is optional on the last key/value pair.

<pre>
title: 	The Test Project 1
<em>&#45;</em>
date: ...
</pre>

#### Values {#values}

If you want one of the values to be empty, leave a space after the colon.

<pre>
title:<em> </em>
&#45;
date: ...
</pre>

Any values which contain a newline character will be parsed as markdown.
Which means within the following example, <em>&#64;title</em> will come through as plain text, while <em>&#64;content</em> will be parsed as markdown.  
This:

<pre>
date: 2009, Jun—
&#45;
content:
Lorem ipsum.
</pre>

will become:

<pre>
&#64;date =&gt; 2009, Jun—

&#64;content =&gt; <em>&lt;p&gt;</em>Lorem ipsum.<em>&lt;/p&gt;</em>
</pre>

### Markdown      {#markdown}

x.

[text files]: http://en.wikipedia.org/wiki/Text_file
[UTF-8 encoding]: http://en.wikipedia.org/wiki/UTF-8<commit_msg>Added Markdown documentation<commit_after>title: Editing Content
-
content:

Content Editing           {#content-editing}
===============

Within the _/content_ directory, there is a file named _\_shared.txt_.

If you open it up with a text editor, you should see:
<pre>
name: <em>Name</em>
&#45;
profession: <em>Graphic Designer</em>
&#45;
email: <em><EMAIL></em>
</pre>

Replace the highlighted data with your own details.

### Text file encoding    {#text-file-encoding}

All of your .txt files should be encoded using UTF-8. In addition to ensuring no strange characters are inserted which could break stacey’s rendering engine, this will also allow you to use special characters such as _&ouml;_, _&mdash;_ or double-byte characters such as _照_ or _ラ_.

Any decent text editor will give you the option to edit and save your text files as UTF-8, so google should be able to provide answers on how to do this with your editor of choice.

You can read more about [text files][] & [UTF-8 encoding][] on Wikipedia.



### Editing content       {#editing-content}
Each folder which is to be displayed as a page should have a _.txt_ file inside it (even if this text file is empty). The name of the .txt file should match up with a file in the _/templates_ folder, as this is how stacey knows which template to use for each page.
![Screenshot of /content folder with 'project.txt' selected](/images/projects-contents-file.png)
![Screenshot of /templates folder with 'project.html' selected](/images/template-selected.png)

### How variables are created:  {#how-variables-are-created}
<ol>
	<li>Browser hits <em>http://yourdomain.com/about/</em>.</li>
	<li>
		<p>Stacey reads the appropriate content file <em>/content/3.about/content.txt</em>.</p>
<pre>
title: About Title
&#45;
content: 
Lorem ipsum.
</pre>
	</li>
	<li>Two variables are extracted from the keys & values from within the .txt file: <em>&#64;title</em> & <em>&#64;content</em>. These will be available for use within the templates.</li>
	<li>Stacey finds the matching template file, in this case, <em>/templates/content.html</em></li>
	<li>
		<p>Stacey replaces the variables in the template and outputs the final html.</p>
		<p>So this template code:</p>
<pre>
&lt;div id=&quot;main&quot;&gt;
  &lt;h1&gt;<em>&#64;title</em>&lt;/h1&gt;
  <em>&#64;content</em>
&lt;/div&gt;
</pre>
	<p>becomes this html:</p>
<pre>
&lt;div id=&quot;main&quot;&gt;
  &lt;h1&gt;<em>About Title</em>&lt;/h1&gt;
  <em>&lt;p&gt;Lorem ipsum.&lt;/p&gt;</em>
&lt;/div&gt;
</pre>
	</li>
</ol>

### Content file format      {#content-file-format}

The content files all follow a standard format; each _key_ is followed by a _:_, a _value_ and a hyphen (&#45;) to close the value. 
<pre>
<em>key</em>: <em>value 
&#45;</em>
</pre>

The keys match up with variable markers in the template files which get replaced with the contents of the _value_. You can create as many of your own keys as you need.

#### Keys {#keys}

A key may only contain the following characters: `<KEY>_`

Essentially, lowercase latin alphanumeric characters and underscores.  
Or, for the more technically inclined, anything which can be matched by the following regular expression: _`/[a-z0-9_]+?:/`_

A standard content file looks something like this:
<pre>
title: The Test Project 1
&#45;
date: 2009, Jun—
&#45;
content: 
Lorem ipsum dolor...

</pre>

#### Separating Keys & Values {#separating-keys-values}

Each value should be followed by a line containing only a hyphen character (although the parser is forgiving of any accidental tabs or spaces).

The hyphen is optional on the last key/value pair.

<pre>
title: 	The Test Project 1
<em>&#45;</em>
date: ...
</pre>

#### Empty Values {#values}

If you want one of the values to be empty, leave a space after the colon.

<pre>
title:<em> </em>
&#45;
date: ...
</pre>

### Markdown      {#markdown}

Any values which contain one or more newline characters (line-breaks) will be parsed as _[Markdown][]_.

Within the following example, &#64;title will come through as plain text, while &#64;content will be parsed as Markdown.  

This:

<pre>
date: 2009, Jun—
&#45;
content:
# Title
Lorem ipsum.
</pre>

will become:

<pre>
&#64;date =&gt; 2009, Jun—

&#64;content =&gt; <em>&lt;h1&gt;</em>Title<em>&lt;/h1&gt;</em> <em>&lt;p&gt;</em>Lorem ipsum.<em>&lt;/p&gt;</em>
</pre>

Because Markdown ignores html, if you prefer, you can use standard markup in place of Markdown. The keys & values mentioned above could just as easily be written out as:

<pre>
date: 2009, Jun—
&#45;
content:
&lt;h1&gt;Title&lt;/h1&gt;
&lt;p&gt;Lorem ipsum.&lt;/p&gt;
</pre>

#### Markdown References     {#markdown-references}

Stacey uses _[PHP Markdown Extra][]_ which is a php-specific version of Markdown. It also adds some of its own functionality, such as fenced code blocks and header ids, so you should refer to its documentation as well as that of the original Markdown.

- [Markdown Documentation][]
- [PHP Markdown Extra Documentation][]

[text files]: http://en.wikipedia.org/wiki/Text_file
[UTF-8 encoding]: http://en.wikipedia.org/wiki/UTF-8
[Markdown]: http://daringfireball.net/projects/markdown/
[Markdown Documentation]: http://daringfireball.net/projects/markdown/syntax/
[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
[PHP Markdown Extra Documentation]: http://michelf.com/projects/php-markdown/extra/
{'fraction_non_alphanumeric': 0.141408969895556, 'fraction_numerical': 0.014745033790702437, 'mean_word_length': 4.363536518396486, 'pattern_counts': {'":': 0, '<': 168, '<?xml version=': 0, '>': 168, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7252337', 'n_tokens_mistral': 3343, 'n_tokens_neox': 3181, 'n_words': 1241}