Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ianlandsman/e0e2db02c8a4f205af67a489b04f8628 to your computer and use it in GitHub Desktop.
Save ianlandsman/e0e2db02c8a4f205af67a489b04f8628 to your computer and use it in GitHub Desktop.
'author' => 'Ian Landsman', // Default author, if not provided in a post
'sort' => '-date',
'path' => 'j/{filename}',
'linkedContent' => function($journal){
$content = str_replace('<p>+++</p>', '<div class="text-center" style="margin-bottom:1rem;">&#9679;</div>', $journal->getContent());
$paragraphs = explode('<p>', $content);
$results = '';
foreach($paragraphs as $paragraph){
if(!empty($paragraph)){
$hash = md5($paragraph);
$results .= '<a name="'.$hash.'"></a><p>'.str_replace('</p>', ' <a href="'.$journal->getUrl().'#'.$hash.'" class="text-sm text-grey">#</a>',$paragraph);
}
}
return $results;
}
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment