1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-25 17:40:29 +00:00
TiddlyWiki5/plugins/tiddlywiki/markdown
RJ Skerry-Ryan 8d9dc0cd29
Markdown: Don't emit paragraph tags when a paragraph is "tight". (#5848)
* markdown: Don't emit paragraph tags when a paragraph is "tight".

Motivation: Since the upgrade to remarkable.js (#3876), lists are rendered as
HTML like this:

```
<ul>
  <li><p>One</p></li>
  <li><p>Two</p></li>
  <li><p>Three</p></li>
</ul>
```

The paragraph nodes insert blocks that break the visual flow of the list and are
unexpected e.g. compared to WikiText markup's rendering of a bulleted list.

Solution: remarkable.js annotates certain paragraph nodes as "tight", and in the
bulleted list case, the paragraph nodes wrapping the text of each list item are
marked tight.

remarkable uses the tight property to [elide paragraph tags in its
renderer](58b6945f20/lib/rules.js (L136-L142)).

This change implements the equivalent logic in TiddlyWiki's markdown rendering:
If a paragraph is marked tight, then we elide the `<p>` tag wrapping its children.

* Use ES5 Array.concat instead of ES6 spread operator.
2021-07-06 11:33:12 +01:00
..
EditorToolbar Update codemirror and markdown plugins from #2315 2016-04-22 08:41:31 +01:00
files Add optional KaTeX support to markdown plugin (#5846) 2021-07-06 11:32:32 +01:00
images Update codemirror and markdown plugins from #2315 2016-04-22 08:41:31 +01:00
config_breaks.tid Replace Markdown parsing library with Remarkable (#3876) 2020-01-20 13:13:36 +00:00
config_linkify.tid Replace Markdown parsing library with Remarkable (#3876) 2020-01-20 13:13:36 +00:00
config_linkNewWindow.tid Replace Markdown parsing library with Remarkable (#3876) 2020-01-20 13:13:36 +00:00
config_quotes.tid Replace Markdown parsing library with Remarkable (#3876) 2020-01-20 13:13:36 +00:00
config_renderWikiText.tid Replace Markdown parsing library with Remarkable (#3876) 2020-01-20 13:13:36 +00:00
config_renderWikiTextPragma.tid Replace Markdown parsing library with Remarkable (#3876) 2020-01-20 13:13:36 +00:00
config_typographer.tid Replace Markdown parsing library with Remarkable (#3876) 2020-01-20 13:13:36 +00:00
docs_type_markdown.tid Update codemirror and markdown plugins from #2315 2016-04-22 08:41:31 +01:00
new-markdown.tid Use match operator instead of prefix 2020-01-05 13:54:06 +00:00
plugin.info Add optional KaTeX support to markdown plugin (#5846) 2021-07-06 11:32:32 +01:00
readme.tid Add optional KaTeX support to markdown plugin (#5846) 2021-07-06 11:32:32 +01:00
usage.tid Replace Markdown parsing library with Remarkable (#3876) 2020-01-20 13:13:36 +00:00
wrapper.js Markdown: Don't emit paragraph tags when a paragraph is "tight". (#5848) 2021-07-06 11:33:12 +01:00

title: $:/plugins/tiddlywiki/markdown/readme

This is a TiddlyWiki plugin for parsing Markdown text, using the [[Remarkable|https://github.com/jonschlinkert/remarkable]] library. If the KaTeX TiddlyWiki plugin is installed, KaTeX support is enabled using the [[remarkable-katex|https://github.com/bradhowes/remarkable-katex]] Remarkable plugin.

It is completely self-contained, and doesn't need an Internet connection in order to work. It works both in the browser and under Node.js.

[[Source code|https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/markdown]]