mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-15 17:02:38 +00:00
Add to migrate document and update colon-replacement for the markdown renderer
This commit is contained in:
@@ -139,25 +139,20 @@ ___
|
|||||||
**Use these find/replace commands in the order listed for the best result.**
|
**Use these find/replace commands in the order listed for the best result.**
|
||||||
|
|
||||||
#### Blockquotes
|
#### Blockquotes
|
||||||
The key difference is the lack of blockquotes. GMBinder uses the `>` symbol at the start of the line for each line in the stat block, and Homebrewery's v3 renderer does not. Running the following find/replace commands with regex enabled should remove the blockquotes:
|
The key difference is the lack of blockquotes. GMBinder uses the `>` symbol at the start of the line for each line in the stat block, and Homebrewery's v3 renderer does not. **You will want to remove all `>` characters at the beginning of all lines, and delete any leading spaces.**
|
||||||
|
|
||||||
| Find | Replace |
|
|
||||||
|:------|:--------|
|
|
||||||
| `^> ` | |
|
|
||||||
| `^>` | |
|
|
||||||
|
|
||||||
#### Lists
|
#### Lists
|
||||||
The basic characteristics and advanced characteristics sections are not list elements in Homebrewery. You can remove them by finding `^- ` and replacing it with nothing.
|
The basic characteristics and advanced characteristics sections are not list elements in Homebrewery. **You will want to remove all `-` or `*` characters from the beginning of lines.**
|
||||||
|
|
||||||
#### Spacing
|
#### Spacing
|
||||||
In order to have the correct spacing after removing the list elements, you will want to add `\:\:` between the name of each basic/advanced characteristic and its value. i.e:
|
In order to have the correct spacing after removing the list elements, **you will want to add two colons (`::`) between the name of each basic/advanced characteristic and its value.** i.e:
|
||||||
```
|
```
|
||||||
**Skills** :: Athletics +6
|
**Skills** :: Athletics +6
|
||||||
```
|
```
|
||||||
|
|
||||||
:
|
:
|
||||||
|
|
||||||
Additionally, in the special traits and actions sections, you will want to add a `\:` at the beginning of each line that separates a trait/action from another, as seen below. This can be accomplished with find/replace by replacing `^$` with `\:`.
|
Additionally, in the special traits and actions sections, you will want to add a colon at the beginning of each line that separates a trait/action from another, as seen below. **Any empty lines between special traits and actions should contain only a colon.**
|
||||||
|
|
||||||
```
|
```
|
||||||
### Actions
|
### Actions
|
||||||
|
|||||||
@@ -535,7 +535,24 @@ module.exports = {
|
|||||||
marked : Markdown,
|
marked : Markdown,
|
||||||
render : (rawBrewText)=>{
|
render : (rawBrewText)=>{
|
||||||
rawBrewText = rawBrewText.replace(/^\\column$/gm, `\n<div class='columnSplit'></div>\n`)
|
rawBrewText = rawBrewText.replace(/^\\column$/gm, `\n<div class='columnSplit'></div>\n`)
|
||||||
.replace(/^(:+)$/gm, (match)=>`${`<div class='blank'></div>`.repeat(match.length)}\n`);
|
.replace(/^(:+)$/gm, (match, _, i)=>{
|
||||||
|
let test, matches=[];
|
||||||
|
const codeBlock = /`/gm, inlineCodeBlock = /[^`]`[^`]/g;
|
||||||
|
while (test = codeBlock.exec(rawBrewText)) {
|
||||||
|
matches.push(test);
|
||||||
|
}
|
||||||
|
// console.log(match, m, i, indexes);
|
||||||
|
if(matches.filter((m)=>m.index < i).length % 2 !== 0) return match;
|
||||||
|
|
||||||
|
// matches = [];
|
||||||
|
// while (test = inlineCodeBlock.exec(rawBrewText)) {
|
||||||
|
// matches.push(test);
|
||||||
|
// }
|
||||||
|
// console.log(matches, match, i);
|
||||||
|
// if(matches.filter((m)=>m.index < i).length % 2 !== 0) return match;
|
||||||
|
|
||||||
|
return `${`<div class='blank'></div>`.repeat(match.length)}\n`;
|
||||||
|
});
|
||||||
return Markdown(
|
return Markdown(
|
||||||
sanatizeScriptTags(rawBrewText),
|
sanatizeScriptTags(rawBrewText),
|
||||||
{ renderer: renderer }
|
{ renderer: renderer }
|
||||||
|
|||||||
Reference in New Issue
Block a user