Markdown to MediaWiki Conversion Guide: Difference between revisions

REGEX markdown to mediawiki: updated regex for issue catching the starting bullets
Exporting to Intellipedia: added header md to mw
 
(One intermediate revision by the same user not shown)
Line 12: Line 12:
Transfer that file over to your government computer securely then open the file in notepad or any other text editor and copy the text. Paste that text into the source editor on Intellipedia.
Transfer that file over to your government computer securely then open the file in notepad or any other text editor and copy the text. Paste that text into the source editor on Intellipedia.


=== REGEX markdown to mediawiki ===
{| class="wikitable"
{| class="wikitable"
! Title !! Find !! Replace !! Description
! Title !! Find !! Replace !! Description
|-
|-
| Bold || \*\*(?!\s)(.*?)(?<!\s)\*\* || <pre>'''$1'''</pre> || Converts markdown bold to MediaWiki bold
| Bold || <pre>\*\*(?!\s)(.*?)(?<!\s)\*\*</pre> || <pre>'''$1'''</pre> || Converts markdown bold to MediaWiki bold
|-
|-
| Heading || =(.*?)= || ==$1== || Adjusts heading level since MediaWiki doesn't support multiple h1 headers
| Heading || <pre>=(.*?)=</pre> || <pre>==$1==</pre> || Adjusts heading level since MediaWiki doesn't support multiple h1 headers
|-
|-
| Bullet || ^ \* || ** || Converts indented bullets to MediaWiki double asterisk
| Bullet || <pre>^ \*</pre> || <pre>**</pre> || Converts indented bullets to MediaWiki double asterisk
|-
|-
| Numbering || ^\d(.?) || # || Converts numbered lists with digits to MediaWiki numbered list format
| Numbering || <pre>^\d(.*?)</pre> || <pre>#</pre> || Converts numbered lists with digits to MediaWiki numbered list format
|-
|-
| Italics || \_(.*?)\_ || ''$1'' || Converts markdown italics to MediaWiki italics
| Italics || <pre>\_(.*?)\_</pre> || <pre>''$1''</pre> || Converts markdown italics to MediaWiki italics
|-
|-
| External Links || \[(.*?)\]\((https?:\/\/.*?)\) || [$2 $1] || Converts markdown external links to MediaWiki format
| External Links || <pre>\[(.*?)\]\((https?:\/\/.*?)\)</pre> || <pre>[$2 $1]</pre> || Converts markdown external links to MediaWiki format
|-
|-
| Internal Links || \[(.*?)\]\((.*?)\.md\) || [[$2|$1]] || Converts markdown internal links to MediaWiki format
| Internal Links || <pre>\[(.*?)\]\((.*?)\.md\)</pre> || <pre>[[$2|$1]]</pre> || Converts markdown internal links to MediaWiki format
|-
|-
| Images || !\[(.*?)\]\((.*?)\) || [[File:$2|alt=$1]] || Converts markdown images to MediaWiki format
| Images || <pre>!\[(.*?)\]\((.*?)\)</pre> || <pre>[[File:$2|alt=$1]]</pre> || Converts markdown images to MediaWiki format
|-
|-
| Code Blocks || ```(.*?)``` ||<nowiki><pre>$1</pre></nowiki>
| Code Blocks || <pre>```(.*?)```</pre> || <pre><nowiki><pre>$1</pre></nowiki></pre> || Converts markdown code blocks to MediaWiki pre tags
| Converts markdown code blocks to MediaWiki pre tags
|-
|-
| Inline Code || `(.*?)` || <code>$1</code> || Converts markdown inline code to MediaWiki code tags
| Inline Code || <pre>`(.*?)`</pre> || <pre><code>$1</code></pre> || Converts markdown inline code to MediaWiki code tags
|-
|-
| Horizontal Rule || ^---$ || ---- || Converts markdown horizontal rule to MediaWiki format
| Horizontal Rule || <pre>^---$</pre> || <pre>----</pre> || Converts markdown horizontal rule to MediaWiki format
|-
| Level 1 Heading (Markdown #) || <pre>^# (.*?)$</pre> || <pre>= $1 =</pre> || Converts Markdown level 1 heading to MediaWiki heading
|-
| Level 2 Heading (Markdown ##) || <pre>^## (.*?)$</pre> || <pre>== $1 ==</pre> || Converts Markdown level 2 heading to MediaWiki heading
|-
| Level 3 Heading (Markdown ###) || <pre>^### (.*?)$</pre> || <pre>=== $1 ===</pre> || Converts Markdown level 3 heading to MediaWiki heading
|}
|}


==== SED ====
==== SED ====