mirror of
https://github.com/ZetaKebab/quartz.git
synced 2025-01-14 22:18:43 +00:00
Merge commit 'd63e5ae6a77e5f39e25d87500c67488ff4570cbc' into jpg
This commit is contained in:
commit
6e29281f91
@ -8,4 +8,10 @@ For my Japanese Grammar (JPG) project, I have created a style for explanation on
|
||||
|
||||
## convert-usage.py
|
||||
|
||||
In my Quartz rendering of my markdown data, I want this kind of data to be in a callout. However, it is not possible to combine HTML and Markdown in Obsidian. For that purpose, this script encapsulates it directly in HTML. To make it both compatible in Obsidian and Quartz, and to be still easy to write, it's done with this python script. This is probably super specific and will not be of use for anybody except me!
|
||||
In my Quartz rendering of my markdown data, I want this kind of data to be in a callout. However, it is not possible to combine HTML and Markdown in Obsidian. For that purpose, this script encapsulates it directly in HTML. To make it both compatible in Obsidian and Quartz, and to be still easy to write, it's done with this python script. This is probably super specific and will not be of use for anybody except me!
|
||||
|
||||
## Usage
|
||||
|
||||
Usage: `python3 convert-usage.py [root folder]`
|
||||
|
||||
Note: Please be careful, this software applies modifications recursively!
|
23
custom/convert-usage/examples/sample2.md
Normal file
23
custom/convert-usage/examples/sample2.md
Normal file
@ -0,0 +1,23 @@
|
||||
# test file
|
||||
|
||||
## Lorem ipsum
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris massa eros, feugiat eu dapibus nec, fermentum vel ex. Nulla malesuada luctus pretium. Phasellus ac felis ut nisi lacinia malesuada nec vel odio. Donec tincidunt tincidunt lorem vel tempus. Nullam sed efficitur ligula, a porttitor nibh. Praesent justo dui, venenatis ac mi non, laoreet consequat libero. Aenean ut molestie mauris. Proin mattis volutpat ligula eget tincidunt. Fusce ex eros, condimentum consectetur efficitur vitae, euismod at justo.
|
||||
|
||||
**Usage**
|
||||
|
||||
<div class="usage">
|
||||
<div class="left">
|
||||
<p><span class="box">item1</span></p>
|
||||
<p><span class="box">item2</span></p>
|
||||
<p><span class="box">item3</span></p>
|
||||
<p><span class="box">item4</span></p>
|
||||
</div>
|
||||
<p class="right">+ final</p>
|
||||
</div>
|
||||
|
||||
## Callout
|
||||
|
||||
> [!info] Example
|
||||
> Callout example
|
||||
> Careful with BS4 encoding some characters
|
@ -29,7 +29,9 @@ def write_file(filename, text):
|
||||
### Replace ###
|
||||
|
||||
def convert_pattern(text):
|
||||
text = re.sub(re_usage, '', text, flags=re.MULTILINE)
|
||||
text, success = re.subn(re_usage, '', text, flags=re.MULTILINE)
|
||||
if (success == 0):
|
||||
return text
|
||||
|
||||
soup = BeautifulSoup(text, features="html.parser")
|
||||
|
||||
@ -40,7 +42,7 @@ def convert_pattern(text):
|
||||
calloutTitle = BeautifulSoup(callout_title_html, features="html.parser")
|
||||
tag.insert_before(calloutTitle)
|
||||
|
||||
return str(soup)
|
||||
return (soup.decode(False, formatter=None))
|
||||
|
||||
|
||||
### Execution ###
|
||||
|
Loading…
Reference in New Issue
Block a user