zk_html/tech/md-ext/editing.html

85 lines
6.9 KiB
HTML

<!doctype html>
<html>
<head>
<title>Zk | Editing Markdown Extension</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Gentium+Plus&family=Lato&family=Ubuntu+Monodisplay=swap" />
<link rel="stylesheet" type="text/css" href="/style.css" />
<meta name="viewport" content="width=device-width" />
<meta charset="utf-8" />
</head>
<body>
<main>
<header>
<h1>Zk | Editing Markdown Extension</h1>
</header>
<article class="content">
<p><span class="tag">tech</span> <span class="tag">markdown</span> <span class="tag">vimwiki</span> <span class="tag">python</span> <span class="tag">package</span></p>
<h2 id="what-it-does">What it does</h2>
<p>I want to be able to have editing comments in Markdown, so I came up with some extensions to the syntax. The goal should be for the text to still be at least mostly readable.</p>
<ul>
<li class="done4"> Additions <code>+{new text}</code></li>
<li class="done4"> Deletions <code>-{old text}</code></li>
<li class="done4"> Substitutions <code>~{old}{new}</code></li>
<li class="done4"> Comments <code>?{la de da}(comment)</code></li>
<li class="done4"> Resolutions <code>!{-{bad wolf}}(STET)</code></li>
<li>Metadata:<ul>
<li class="done4"> Comments on all types in parentheses after <code>~{old}{new}(comment)</code> etc</li>
<li class="done4"> Attribution in parentheses in comment <code>+{new}(comment (Commenter))</code></li>
<li class="done4"> Date with attribution <code>-{old}(comment (Commenter 2020-04-21))</code></li>
<li class="done0"> Comment as footnote <code>?{la de da}(^note) ... (^note): comment</code></li>
<li class="done0"> Comments can contain markup <code>?{la de da}(some *markup*)</code></li>
</ul>
</li>
</ul>
<div class="codehilite"><pre><span></span><code><span class="nv">This</span> <span class="nv">is</span> <span class="nv">a</span> <span class="o">+</span>{<span class="nv">new</span>} <span class="nv">addition</span>
<span class="nv">This</span> <span class="o">-</span>{<span class="nv">this</span>} <span class="nv">word</span> <span class="nv">is</span> <span class="nv">removed</span>
<span class="nv">I</span> <span class="nv">say</span>, <span class="o">~</span>{<span class="nv">out</span> <span class="nv">with</span> <span class="nv">the</span> <span class="nv">old</span>}{<span class="nv">in</span> <span class="nv">with</span> <span class="nv">the</span> <span class="nv">new</span>}
<span class="nv">Here</span> <span class="o">!</span>{<span class="nv">just</span> <span class="nv">a</span> <span class="nv">comment</span>} <span class="nv">is</span> <span class="nv">a</span> <span class="nv">line</span> <span class="nv">with</span> <span class="nv">a</span> <span class="nv">comment</span>
<span class="nv">You</span> <span class="nv">can</span> <span class="nv">also</span> ?{<span class="nv">add</span> <span class="nv">comments</span> <span class="nv">to</span> <span class="nv">some</span> <span class="nv">text</span>}<span class="ss">(</span><span class="nv">Like</span> <span class="nv">this</span><span class="ss">)</span>
<span class="nv">All</span> <span class="o">-</span>{<span class="nv">new</span>}<span class="ss">(</span><span class="nv">Redundant</span> <span class="ss">(</span><span class="nv">Makyo</span><span class="ss">))</span> <span class="nv">edit</span> <span class="nv">marks</span> <span class="nv">can</span> <span class="nv">have</span> <span class="nv">comments</span> <span class="nv">with</span> <span class="nv">attributions</span> <span class="nv">and</span> <span class="nv">dates</span> <span class="o">+</span>{<span class="nv">like</span> <span class="nv">this</span>}<span class="ss">(</span><span class="nv">See</span>? <span class="ss">(</span><span class="nv">Makyo</span> <span class="mi">2020</span><span class="o">-</span><span class="mi">04</span><span class="o">-</span><span class="mi">22</span><span class="ss">))</span> <span class="ss">(</span><span class="nv">though</span> <span class="nv">it</span><span class="s1">&#39;</span><span class="s">s ignored with comments !{like this}(won</span><span class="s1">&#39;</span><span class="nv">t</span> <span class="k">show</span><span class="ss">))</span>
<span class="nv">Bottom</span> <span class="nv">text</span>
</code></pre></div>
<p>This is a <ins class="addition">new</ins> addition</p>
<p>This <del class="deletion">this</del> word is removed</p>
<p>I say, <span class="substitution"><del>out with the old</del><ins>in with the new</ins></span></p>
<p>Here <q class="comment">just a comment</q> is a line with a comment</p>
<p>You can also <mark class="selected">add comments to some text<q class="comment">Like this</q></mark></p>
<p>All <del class="deletion">new<q class="comment">Redundant<span class="attribution">Makyo</span></q></del> edit marks can have comments with attributions and dates <ins class="addition">like this<q class="comment">See?<span class="attribution">Makyo</span><span class="date">2020-04-22</span></q></ins> (though it&rsquo;s ignored with comments <q class="comment">like this<span class="attribution">won&rsquo;t show</span></q>)</p>
<p>Bottom text</p>
<h2 id="how-to-use-it">How to use it</h2>
<div class="codehilite"><pre><span></span><code><span class="n">default_config</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">&#39;tag_tuple&#39;</span><span class="p">:</span> <span class="p">(</span><span class="s1">&#39;&lt;div class=&quot;verse&quot;&gt;&#39;</span><span class="p">,</span> <span class="s1">&#39;&lt;/div&gt;&#39;</span><span class="p">),</span>
<span class="p">}</span>
<span class="n">my_config</span> <span class="o">=</span> <span class="p">{</span>
<span class="s1">&#39;tag_tuple&#39;</span><span class="p">:</span> <span class="p">(</span><span class="s1">&#39;&lt;verse&gt;&#39;</span><span class="p">,</span> <span class="s1">&#39;&lt;/verse&gt;&#39;</span><span class="p">),</span>
<span class="p">}</span>
<span class="n">markdown</span><span class="p">(</span><span class="n">source</span><span class="p">,</span> <span class="n">extensions</span><span class="o">=</span><span class="p">[</span><span class="n">VerseExtension</span><span class="p">(</span><span class="o">**</span><span class="n">my_config</span><span class="p">)])</span>
</code></pre></div>
<h2 id="where-to-get-it">Where to get it</h2>
<ul>
<li><a href="https://pypi.com/project/markdown-verse">PyPI</a></li>
<li><a href="https://github.com/makyo/markdown-verse">Github</a></li>
</ul>
</article>
<footer>
<p>Page generated on 2023-05-10</p>
</footer>
</main>
<script type="text/javascript">
document.querySelectorAll('.tag').forEach(tag => {
let text = tag.innerText;
tag.innerText = '';
tag.innerHTML = `<a href="/tags.html#${text}">${text}</a>`;
});
</script>
</body>
</html>