Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link directives - properly support custom link text as documented #515

Merged
merged 2 commits into from
Sep 6, 2023

Conversation

jenshalm
Copy link
Contributor

@jenshalm jenshalm commented Sep 4, 2023

Addresses the issue reported in #506, but not with the reported syntax, but instead the one actually originally documented.

The reported syntax did piggy-back on exiting id-based linking: [text][@:api(foo.Bar)].
But the reported undesired lower-case transformation of the type name is based on the fact that link ids are normalized early and deferring that step comes with a high risk of regressions for standard links.

Instead this PR implements custom link texts for link directives based on the literal URL syntax of native text markup as these do not undergo any transformations before rendering: [text](@:api(foo.Bar)). The syntax is not ideal, due to the double closing parenthesis, but it's the most robust option for now for a feature that is not heavily used.

The third option, using standard directive syntax with nested bodies @:api(foo.Bar) link text @:@ had to be discarded due to the fact that directives do not support optional bodies for avoiding potentially significant parsing inefficiencies. The only way this syntax could be supported would be with different directive names for links with and without custom link text which feels even less intuitive than the approach chosen now.

Closes #506.

@jenshalm jenshalm added the bug label Sep 4, 2023
@jenshalm jenshalm added this to the 0.19.4 milestone Sep 4, 2023
@jenshalm jenshalm merged commit 6764307 into 0.19.x Sep 6, 2023
1 check passed
@jenshalm jenshalm deleted the fix/link-directive branch September 6, 2023 11:58
jenshalm added a commit that referenced this pull request Sep 7, 2023
* fix CSS for Helium UI-components for setups diverging from the defaults (#456)
* render class attribute as render hint for top navigation bar
* render class attribute as render hint for landing page
  based on approximate perceptual luminance of configured gradient colors
* amend Helium CSS variable generator to produce new scoped mappings
* adjust Helium CSS for new CSS variable mappings
* fix css for ui-components on landing page
* adjust transparent overlay for inverted color mode
* hover for landing page button that works in all modes
* satisfy mima with default impl

* prepare 0.19.3 release

* release version 0.19.3

* Update sbt, scripted-plugin to 1.9.1 in 0.19.x (#458)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update scalafmt-core to 3.7.7 in 0.19.x (#459)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update cats-effect to 3.5.1 in 0.19.x (#460)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* link validation - more config options and better defaults (#432)

* add new LinkValidation config types
* switch config default to LinkValidation.Local for core transformer

* introduce DocumentTree.builder (#436)

* extract DocumentTreeBuilder from parser runtime in laika-io
* DocumentTreeBuilder - scaladoc and deprecations
* DocumentTreeBuilder - add new spec that tests new API directly

* Update sbt, scripted-plugin to 1.9.2 in 0.19.x (#471)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update sbt-scalajs-crossproject to 1.3.2 in 0.19.x (#470)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update scalafmt-core to 3.7.9 in 0.19.x (#472)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update sbt-mima-plugin to 1.1.3 in 0.19.x (#476)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update scalafmt-core to 3.7.10 in 0.19.x (#478)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update http4s-dsl, http4s-ember-server to 0.23.23 in 0.19.x (#477)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update sbt, scripted-plugin to 1.9.3 in 0.19.x (#479)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update scalafmt-core to 3.7.11 in 0.19.x (#480)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update scalafmt-core to 3.7.12 in 0.19.x (#486)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update cats-core to 2.10.0 in 0.19.x (#496)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update fs2-io to 3.8.0 in 0.19.x (#481)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* plugin: print full URL in preview server boot message (#500)

* TreeParserSpec: add test for skipping validation to other versions

* Update sbt, scripted-plugin to 1.9.4 in 0.19.x (#504)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* manual: add missing info for running separate parsers and renderers (#501)

* helium: introduce new config for including CSS and JS

* helium: add tests for new config for CSS/JS includes

* adjust whitespace in plugin tests for helium template changes

* manual: documentation for new Helium config for CSS/JS includes.

* Added css to ensure code renders properly in sidebar on highlight (#507)

* Markdown spec: bullet lists do no longer require preceding empty lines (#502)

* scala 3 support: avoid use of inline as member name

* exclude mima issue on package-private type

* formatting

* Update fs2-io to 3.9.1 in 0.19.x (#508)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update scalafmt-core to 3.7.13 in 0.19.x (#510)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* Update sbt-scalafmt to 2.5.2 in 0.19.x (#509)

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>

* introduce cursor.currentDocument.rawTitle (#512)

* ASTRenderer - simplify rendering of ResolvedInternalTarget

* preview server - add rendering of AST pages

* preview server - fix URLs and links of new AST page renderer

* preview server - formatting

* Markdown spec compliance: allow URLs with nested parenthesis (#514)

* link directives - properly support custom link text as documented (#515)

* link directives - properly support custom link text as documented
* address mima issues by using a new private case class instead

* helium - add mermaid support (#516)

* remove old directives for linking CSS/JS and their config API

* rename LaikaConfig.encoding to withEncoding to match 0.19.4

* Revert "adjust whitespace in plugin tests for helium template changes"

This reverts commit aeeb7f1

* remove old HTML head directives from documentation

* remove unused parameter in DocumentTreeBuilder

* resurrect test for including resources from a theme

---------

Co-authored-by: typelevel-steward[bot] <106827141+typelevel-steward[bot]@users.noreply.github.com>
Co-authored-by: Jamie Willis <J_mie@hotmail.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant