URL highlighting text tinkering: Difference between revisions

From MWStake
Jump to navigation Jump to search
No edit summary
ย 
Line 6: Line 6:
#* <code>[</code>
#* <code>[</code>
# Then add the pages URL, for example:
# Then add the pages URL, for example:
#* <code><nowiki>https://mwstake.org/mwstake/wiki/URL_highlighting_text_tinkering</nowiki></code>
#* <code><nowiki>https://mwstake.org/wiki/URL_highlighting_text_tinkering</nowiki></code>
# Add this little snippet:
# Add this little snippet:
#* <code>#:~:text=</code>
#* <code>#:~:text=</code>
Line 16: Line 16:
#* <code>&nbsp; Cool highlighted link]</code>
#* <code>&nbsp; Cool highlighted link]</code>
# Putting this all together, you get:
# Putting this all together, you get:
#* <code>&#91;htt<nowiki>p</nowiki>s://mwstake.org/mwstake/wiki/URL_highlighting_text_tinkering#:~:text={<nowiki>{</nowiki>urlencode:highlight sections of text|PATH}} Cool tip]</code>
#* <code>&#91;htt<nowiki>p</nowiki>s://mwstake.org/wiki/URL_highlighting_text_tinkering#:~:text={<nowiki>{</nowiki>urlencode:highlight sections of text|PATH}} Cool tip]</code>
# Which results in (need to open in a new tab):
# Which results in (need to open in a new tab):
#* [https://mwstake.org/mwstake/wiki/URL_highlighting_text_tinkering#:~:text={{urlencode:highlight sections of text|PATH}} Cool tip]
#* [https://mwstake.org/wiki/URL_highlighting_text_tinkering#:~:text={{urlencode:highlight sections of text|PATH}} Cool tip]




Line 24: Line 24:
# The same format can be used to capture longer strings without capturing all the text by separating the two sections of text with a comma <code>,</code>
# The same format can be used to capture longer strings without capturing all the text by separating the two sections of text with a comma <code>,</code>
# For example:
# For example:
#* <code>&#91;htt<nowiki>p</nowiki>s://mwstake.org/mwstake/wiki/URL_highlighting_text_tinkering#:~:text={<nowiki>{</nowiki>urlencode:URLs to websites|PATH}},{<nowiki>{</nowiki>urlencode:section of the text.|PATH}} Cool tip 2]</code>
#* <code>&#91;htt<nowiki>p</nowiki>s://mwstake.org/wiki/URL_highlighting_text_tinkering#:~:text={<nowiki>{</nowiki>urlencode:URLs to websites|PATH}},{<nowiki>{</nowiki>urlencode:section of the text.|PATH}} Cool tip 2]</code>
# Which results in (need to open in a new tab):
# Which results in (need to open in a new tab):
#* [https://mwstake.org/mwstake/wiki/URL_highlighting_text_tinkering#:~:text={{urlencode:URLs to websites|PATH}},{{urlencode:section of the text.|PATH}} Cool tip 2]
#* [https://mwstake.org/wiki/URL_highlighting_text_tinkering#:~:text={{urlencode:URLs to websites|PATH}},{{urlencode:section of the text.|PATH}} Cool tip 2]





Latest revision as of 01:58, 2 August 2024

URLs to websites (including wikis) can highlight sections of text using the pages URL, followed by #:~:text=, and ending with the URL encoded section of the text.


Build the link

  1. Start with a normal external link bracket:
    • [
  2. Then add the pages URL, for example:
    • https://mwstake.org/wiki/URL_highlighting_text_tinkering
  3. Add this little snippet:
    • #:~:text=
  4. Add the URL PATH encoded section of the text you want to highlight using {{urlencode:string|PATH}}
    • {{urlencode:highlight sections of text|PATH}}
    • Which results in:
      • highlight%20sections%20of%20text
  5. Then finish with a space (normal for an external link), the alternative text (probably ideal since the URL will likely be long), and then a closing bracket:
    •   Cool highlighted link]
  6. Putting this all together, you get:
    • [https://mwstake.org/wiki/URL_highlighting_text_tinkering#:~:text={{urlencode:highlight sections of text|PATH}} Cool tip]
  7. Which results in (need to open in a new tab):


Longer sections of text

  1. The same format can be used to capture longer strings without capturing all the text by separating the two sections of text with a comma ,
  2. For example:
    • [https://mwstake.org/wiki/URL_highlighting_text_tinkering#:~:text={{urlencode:URLs to websites|PATH}},{{urlencode:section of the text.|PATH}} Cool tip 2]
  3. Which results in (need to open in a new tab):


Notes