zk_html/tech/md-ext/editing.html

86 lines
7.1 KiB
HTML
Raw Normal View History

2020-04-22 06:55:08 +00:00
<!doctype html>
<html>
<head>
<title>Zk | Editing Markdown Extension</title>
<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>
2020-04-22 21:15:07 +00:00
<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>
2020-04-22 06:55:08 +00:00
<li>Metadata:<ul>
2020-04-22 21:15:07 +00:00
<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>
2020-04-22 06:55:08 +00:00
</ul>
</li>
</ul>
2020-06-24 07:10:07 +00:00
<div class="codehilite"><pre><span></span><code><span class="n">This</span> <span class="k">is</span> <span class="n">a</span> <span class="o">+</span><span class="err">{</span><span class="k">new</span><span class="err">}</span> <span class="n">addition</span>
2020-04-22 21:15:07 +00:00
2020-06-24 07:10:07 +00:00
<span class="n">This</span> <span class="o">-</span><span class="err">{</span><span class="n">this</span><span class="err">}</span> <span class="n">word</span> <span class="k">is</span> <span class="n">removed</span>
2020-04-22 21:15:07 +00:00
2020-06-24 07:10:07 +00:00
<span class="n">I</span> <span class="n">say</span><span class="p">,</span> <span class="o">~</span><span class="err">{</span><span class="k">out</span> <span class="k">with</span> <span class="n">the</span> <span class="k">old</span><span class="err">}{</span><span class="k">in</span> <span class="k">with</span> <span class="n">the</span> <span class="k">new</span><span class="err">}</span>
2020-04-22 21:15:07 +00:00
2020-06-24 07:10:07 +00:00
<span class="n">Here</span> <span class="o">!</span><span class="err">{</span><span class="n">just</span> <span class="n">a</span> <span class="k">comment</span><span class="err">}</span> <span class="k">is</span> <span class="n">a</span> <span class="n">line</span> <span class="k">with</span> <span class="n">a</span> <span class="k">comment</span>
2020-04-22 21:15:07 +00:00
2020-06-24 07:10:07 +00:00
<span class="n">You</span> <span class="n">can</span> <span class="n">also</span> <span class="o">?</span><span class="err">{</span><span class="k">add</span> <span class="n">comments</span> <span class="k">to</span> <span class="k">some</span> <span class="nb">text</span><span class="err">}</span><span class="p">(</span><span class="k">Like</span> <span class="n">this</span><span class="p">)</span>
2020-04-22 21:15:07 +00:00
2020-06-24 07:10:07 +00:00
<span class="k">All</span> <span class="o">-</span><span class="err">{</span><span class="k">new</span><span class="err">}</span><span class="p">(</span><span class="n">Redundant</span> <span class="p">(</span><span class="n">Makyo</span><span class="p">))</span> <span class="n">edit</span> <span class="n">marks</span> <span class="n">can</span> <span class="n">have</span> <span class="n">comments</span> <span class="k">with</span> <span class="n">attributions</span> <span class="k">and</span> <span class="n">dates</span> <span class="o">+</span><span class="err">{</span><span class="k">like</span> <span class="n">this</span><span class="err">}</span><span class="p">(</span><span class="n">See</span><span class="o">?</span> <span class="p">(</span><span class="n">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="p">))</span> <span class="p">(</span><span class="n">though</span> <span class="n">it</span><span class="s1">&#39;s ignored with comments !{like this}(won&#39;</span><span class="n">t</span> <span class="k">show</span><span class="p">))</span>
2020-04-22 21:15:07 +00:00
2020-06-24 07:10:07 +00:00
<span class="n">Bottom</span> <span class="nb">text</span>
2020-04-22 21:15:07 +00:00
</code></pre></div>
2020-04-22 10:13:28 +00:00
<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>
2020-04-22 10:35:06 +00:00
<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>
2020-06-24 07:10:07 +00:00
<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>
2020-04-22 21:15:07 +00:00
<p>Bottom text</p>
2020-04-22 06:55:08 +00:00
<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>
2020-06-24 07:10:07 +00:00
<p>Page generated on 2020-06-24</p>
2020-04-22 06:55:08 +00:00
</footer>
</main>
2020-06-24 07:10:07 +00:00
<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>
2020-04-22 06:55:08 +00:00
</body>
</html>